Search for two words in a File

Kayvan A. Sylvan kayvan at sylvan.com
Wed Apr 26 17:56:57 UTC 2006


On Wed, Apr 26, 2006 at 02:52:03PM +0100, Matt Davey wrote:
> On Wed, 2006-04-26 at 12:53 +0100, Paul Howarth wrote:
> > Tim wrote:
> > > On Wed, 2006-04-26 at 10:50 +0100, Paul Howarth wrote:
> > >> grep -E 'deep|html' test
> > > 
> > > Wouldn't that match against *either* word, rather than require both to
> > > be present?

If you want a list of files that contain both words, do:

cd direcory-where-files-reside
find . -type f | xargs grep -l word1 | xargs grep -l word2

-- 
Kayvan A. Sylvan          | Proud husband of       | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan, | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | my beautiful Queen.    | Robin Gregory (2/28/92)




More information about the users mailing list