grep
Sean
seanlkml at sympatico.ca
Sun Jan 30 19:19:06 UTC 2005
On Sun, January 30, 2005 1:48 pm, Bill Gradwohl said:
> 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.
# grep -E '(.*(bird|cat|dog)){3}'
Which demands that an enclosed item appear 3 times... which means
cat cat cat
dog bird dog
etc..
will also match, so it's not exactly what you're looking for.
Sean
More information about the fedora-list
mailing list