serious awk bug
Mike McNally
m5 at lynx.uucp
Thu Mar 15 01:25:00 AEST 1990
tps at chem.ucsd.edu (Tom Stockfisch) writes:
>The following awk script doesn't behave properly:
>#! /bin/sh
>awk '/^a*[^b]/ { print "1:", $0 }
>/^a*b/ { print "2:", $0 }
>'
>When given the following input
>b
>ab
>It produces the following output
>2: b
>1: ab
>2: ab
>Basically, the line "ab" should match only rule 2 . . .
I disagree:
a*[^b] => <null>[^b] => <null>a
The a* is matching the empty string, and the [^b] is matching the a.
--
Mike McNally Lynx Real-Time Systems
uucp: {voder,athsys}!lynx!m5 phone: 408 370 2233
Where equal mind and contest equal, go.
More information about the Comp.unix.wizards
mailing list