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

Reply via email to