egrep on the 3b1 is weird!

Tom Tkacik tkacik at kyzyl.mi.org
Sat Mar 23 12:01:44 AEST 1991


In article <1268 at hico2.UUCP>, kak at hico2.UUCP (Kris A. Kugel) writes:
> Am I confused, or does egrep on the 3b1
> handle multiple regular expressions incorrectly?
> 
> 	egrep 'foo|bar'
> 
> seems to match '[fb][oa][or]' patterns,
> instead of what I wanted (matching lines with "foo" or "bar")
 

According to the man page   egrep 'foo|bar'   should match any line
containing either 'foo' or 'bar'.  I just tried it on kyzyl, and
it seems to work properly.  It does not match any line containing
either 'boo' or 'far', (or other incorrect pattern mentioned above).

I suggest that Kris check again.

Someone stated that the | has higher precedence than concatination,
and that the above is equivalent to    egrep 'fo(o|b)ar', and will
match  either 'fooar' or 'fobar'.
It will match these, but only because they are a subset of
the patterns it will match.
-- 
Tom Tkacik                |
tkacik at kyzyl.mi.org       |     To rent this space, call 1-800-555-QUIP.
...!rphroy!kyzyl!tkacik   |



More information about the Comp.sys.3b1 mailing list