grep
Bill Gradwohl
bill at ycc.com
Sun Jan 30 18:48:50 UTC 2005
According to the grep man page:
Grep understands two different versions of regular expression syntax:
“basic” and “extended.” In GNU grep, there is no difference in avail-
able functionality using either syntax.
However, the following function differently:
grep -G 'cat|dog|bird' filename (Basic)
grep -E 'cat|dog|bird' filename (Extended)
Am I interpreting something incorrectly?
The command :
grep -E 'cat|dog|bird' filename
will output any line that contains cat OR dog OR bird or any combination.
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.
--
Bill Gradwohl
bill at ycc.com
http://www.ycc.com
spamSTOMPER Protected email
More information about the fedora-list
mailing list