[Linux-disciples] Find all files matching all patterns

Stephen R Laniel steve at laniels.org
Tue Aug 22 16:15:24 EDT 2006


If I want to find all the files under dirName that match
string1 and string2 and ... and stringN, I do

grep -irl string1 dirName |xargs -i grep -il string2 '{}' |xargs -i grep -il string3 '{}' |... [more of the same up to stringN]

Is there any better way to do this? I've written a little
Perl script to do it:
http://laniels.org/scripts/matches_all.pl.txt

But I wonder if y'all have a better idea.

-- 
Stephen R. Laniel
steve at laniels.org
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20060822/40853e1d/attachment.pgp


More information about the Linux-disciples mailing list