Search for two words in a File

Justin Willmert justin at jdjlab.com
Wed Apr 26 11:45:51 UTC 2006


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 to search for both words in the same line, just pipe the output:

cat thefile | grep html | grep test

First it'll find all the 'html' lines and then within those results, 
it'll narrow down to the 'test' lines.


Justin Willmert




More information about the users mailing list