[EMAIL PROTECTED] wrote: >On Fri, 10 May 2002, Jean-Yves Le Metayer wrote: > >>Here below is described a bug of this version : >> >>sample ASCII file (sample.txt) >>------------------------------ >>ab AB >>AB ab >>cd CD >>CD cd >> >[snip] > >>simple awk file (simple.awk) >>---------------------------- >>{ line++ } >>! /^[A-Z]+/ { print line " -> " $0 } >> > >>command >>------- >> >>>cat sample.txt | awk -f simple.awk >>> >>result >>------ >>1 -> ab AB >> >>Strange result, isn't it? >>The expected result is : >>1 -> ab AB >>3 -> cd CD >> >>BUG! At first, I don't believe it. The awk in Mandrake 8.1 cannot be >>used. >>Is it the same behavior in Mandrake 8.2? >> > >Hmmm.. odd error. I wonder if it's picking up the front anchor as a >negation. Your syntax *looks* correct for, but I suspect that awk >is interpreting either the bang or the circumflex differently that >expected. Try: > >{ line++ } >/^[^[:upper:]]+/ { print line " -> " $0 } > >What are you specifically trying to match (in English)? >There may be an advantage (as far as execution is concerned) to look for >the negation since the check would stop on the first non-match, but it >may be a moot point. > > > > >------------------------------------------------------------------------ > >Want to buy your Pack or Services from MandrakeSoft? >Go to http://www.mandrakestore.com > Not strange at all...
in a terminal window, run locale Check the value of LC_COLLATE If it is en_US this is quite normal, the collating sequence is AaBbCc, etc. If you want the result you seek, make your program use upper as suggested or set your LC_COLLATE to POSIX. No, it is not a bug, it is a standard expanded feature that keeps programmers on their toes to write platform independent stuff. Civileme
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com