LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 12-06-2012, 02:20 PM   #1
andreqb
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?

thanksss

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

Rep: Reputation: 31
Quote:
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:
Code:
find . -type f -execdir fgrep -lf temp '{}' ';'
This will, for every file in the directory, call
Code:
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 03:13 PM.
 
  


Reply


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 03:21 PM
[SOLVED] Find a file in directories without using find command sikanders Linux - Newbie 14 08-06-2010 08:47 PM
Find/grep/wc command to find matching files, print filename and word count dbasch Linux - Newbie 10 09-14-2009 05:55 PM
Single find command to find multiple files? thok Linux - Newbie 7 01-31-2009 04:45 PM
can't find my find command! how to replace? dave247 Debian 4 11-19-2008 10:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:25 AM.

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