Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rphroy!kyzyl!tkacik From: tkacik@kyzyl.mi.org (Tom Tkacik) Newsgroups: comp.sys.3b1 Subject: Re: egrep on the 3b1 is weird! Keywords: egrep unix-pc 3b1 Message-ID: <307@kyzyl.mi.org> Date: 23 Mar 91 02:01:44 GMT References: <1268@hico2.UUCP> Organization: Somewhere in Royal Oak, MI Lines: 26 In article <1268@hico2.UUCP>, kak@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@kyzyl.mi.org | To rent this space, call 1-800-555-QUIP. ...!rphroy!kyzyl!tkacik |