Path: utzoo!attcan!uunet!ogicse!uwm.edu!zaphod.mps.ohio-state.edu!usc!apple!mips!daver!lynx!m5 From: m5@lynx.uucp (Mike McNally) Newsgroups: comp.unix.wizards Subject: Re: serious awk bug Keywords: awk Message-ID: <7232@lynx.UUCP> Date: 14 Mar 90 15:25:00 GMT References: <702@chem.ucsd.EDU> Organization: Lynx Real-Time Systems, Inc., Campbell CA Lines: 52 tps@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] => [^b] => 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.