[Linux-disciples] grep more than one phrase
Stephen R Laniel
steve at laniels.org
Wed Apr 23 14:40:20 EDT 2008
On Wed, Apr 23, 2008 at 12:41:22PM -0400, Adam Rosi-Kessel wrote:
> If you are getting more complex than that, you should probably use perl.
If you want to search for all files that contain both 'foo'
and 'bar', do
grep -irl foo /some/path | xargs -i grep -i bar '{}'
To list only matching *filenames*, rather than displaying
the actual matching lines, replace that last 'grep -i' with
a 'grep -il'.
--
Stephen R. Laniel
steve at laniels.org
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
More information about the Linux-disciples
mailing list