egrep on the 3b1 is weird!

Kris A. Kugel kak at hico2.UUCP
Fri Mar 22 09:04:03 AEST 1991


> <- David Herron, an MMDF & WIN/MHS guy, <david at twg.com>

In article <8783 at gollum.twg.com>, david at twg.com (David S. Herron) writes:
> 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")
> 
> Try
> 
> 	egrep '(foo)|(bar)'

I'll try this, thanks for the method.
  
> And read the F'ing manual a little more closely next time ...

No need to get hostile, I did after your message.  Carefully.

It says,

"3. Two regular expressions separated by | or by a
    new line match strings that are matched by either.
 4. A regular expression may be enclosed in parentheses () for grouping.

    The order of precedence of operators is [], then * ? + ,
    then concatenation, then | and new-line."

Now, if you want to complain that I missed something obvious
and well documented, fine.  If what you describe is really how
the feature is designed, then I claim that that is NOT obvious
from the description on the manual page.

Now, I could see from this description that maybe the pattern I
tried would match  "fo[bo]ar", but that was NOT the behavior
I remember seeing.  

I claim that either the manual page is very poorly written,
or else what I tried should have given me CLEARLY different
results than I got.

Now, to find the egrep on osu-cis . . . .

                               Kris A. Kugel
                             ( 908 ) 842-2707
                      uunet!tsdiag.ccur.com!hico2!kak
                        {daver,ditka,zorch}!hico2!kak
                      internet: kak at hico2.westmark.com



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