Matthew Bettinger <[EMAIL PROTECTED]> writes:

> I have a list of files (hundreds) in directory . and need to search through 
> and delete every file that contains the word foo.

Assuming that "directory" means "directory tree" and that "word" means
"string", this might work:

find . -type f -print0 | xargs -0 grep --null -l foo | xargs -0 rm -f

Test this or whatever you use thoroughly; such things are likely to
delete things you don't want deleted and/or not delete things you you
want deleted.  You're likely to want additional options on "rm", like
maybe "-P".  Use the man pages to know what you are doing and can do --
and test things well using test directories, etc.

If you really meant "word foo", then you've got a much tougher job,
starting with defining "word".  See the grep manual, at least.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to