grep

Mike Klinke lsomike at futzin.com
Sun Jan 30 19:03:01 UTC 2005


On Sunday 30 January 2005 12:48, Bill Gradwohl wrote:
 
>
> Does anyone know how to construct a regular expression or in any
> way get a single grep execution to do an AND instead of an OR
> operation so that it looks for more that one string and matches a
> line when ALL the items exist on that line, and are possibly in
> RANDOM order?
>
> i.e. Find these lines
> cat dog bird
> bird dog cat
> dog cat bird
> etc.
>
 

Not a single grep expression but .....

grep "dog" <filename> | grep "cat" | grep "bird"

Regards, Mike Klinke




More information about the users mailing list