bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GAWK Bug Report


From: Aharon Robbins
Subject: Re: GAWK Bug Report
Date: Fri, 21 Dec 2007 11:32:26 +0200

Greetings. Re this:

> Date: Thu, 20 Dec 2007 12:36:26 -0800 (PST)
> From: Peter Graglia <address@hidden>
> Subject: GAWK Bug Report
> To: address@hidden, address@hidden, address@hidden

Boy are those two first addresses very very very out of date. :-)
The last one is the correct one to use.

> Hello,
> I wish to report a problem I am experiencing with GAWK
> version 3.1.5. It incorrectly handles the regular
> expression character set, [a-z], by matching both
> lower case and upper case letters.  This works
> properly with GAWK 3.0.3 (Windows) and in the original
> AWK as shown below.

This has to do with the fact that 3.1.x versions of gawk support
locale-based regular expression matching. In particular, your locale is
likely en_US.UTF-8 or some such, which defines that a-z includes many
of the uppercase letters.

You should instead be using:

        /^[[:lower:]]/

to match lower case letters.  All of this is (and has been) clearly
documented in the gawk documentation.

To restore the behavior you are expecting, you can use:

        export LC_ALL=C

in your bash startup file. (This is what I do. :-)

> I have known about AWK for years, but never bothered
> to learn it.  A coworker recently helped me out of a
> difficult spot with a little AWK magic and now I am
> hooked.  

Great!  Awk programming is a lot of fun.

> Please let me know if there is any other information
> that would be helpful.

I highly recommend reading the gawk manual, either what comes with
the gawk dist, or purchasing a copy of "Effective AWK Programming",
3rd edition, published by O'Reilly, which eventually puts a few cents
into my pocket. :-)

Hope this helps,

Arnold




reply via email to

[Prev in Thread] Current Thread [Next in Thread]