Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-06-2012, 03:20 PM   #1
LQ Newbie
Registered: Dec 2012
Posts: 1

Rep: Reputation: Disabled
Pass file like list of params to find command

Hi everybody,

I have a list of ids and I need to find all files that contains this ids, the ideia is delete all this files.

This command returns me all files but in the same line:

find . -type f -print0 | fgrep -zFf temp

ps: temp is a file with all ids.

How can I find all files that contains all these ids?


Last edited by andreqb; 12-06-2012 at 03:25 PM.
Old 12-06-2012, 04:11 PM   #2
Registered: May 2009
Distribution: Debian wheezy
Posts: 252

Rep: Reputation: 31
Originally Posted by andreqb View Post
Hi everybody,

I have a list of ids and I need to find all files that contains this ids
By contain I assume you mean that the id is in the contents of the file; you seem to be checking for the id in the file name. If you mean to search for the ids in the contents of the files, try the following:
find . -type f -execdir fgrep -lf temp '{}' ';'
This will, for every file in the directory, call
fgrep -lf temp <filename>
The -l says to print out the name of the file if, and only if, it matches one of the patterns in temp; no other output is generated.

As a side note, "fgrep" is the same as "grep -F", rendering a second -F unnecessary.

Last edited by hda7; 12-06-2012 at 04:13 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with find command and rar/unrar command line krakatoa1 *BSD 6 09-11-2012 04:21 PM
[SOLVED] Find a file in directories without using find command sikanders Linux - Newbie 14 08-06-2010 09:47 PM
Find/grep/wc command to find matching files, print filename and word count dbasch Linux - Newbie 10 09-14-2009 06:55 PM
Single find command to find multiple files? thok Linux - Newbie 7 01-31-2009 05:45 PM
can't find my find command! how to replace? dave247 Debian 4 11-19-2008 11:51 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:33 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration