[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Bug with GNU Awk 3.1.4
From: |
Andrew J. Schorr |
Subject: |
Re: [bug-gawk] Bug with GNU Awk 3.1.4 |
Date: |
Tue, 15 Mar 2016 12:46:11 -0400 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi,
On Mon, Mar 14, 2016 at 09:32:48PM -0400, Christo M wrote:
> I would like to report a bug with GNU Awk version 3.1.4.
I have 3 comments about your problem:
1. This is a really old version of gawk. Please upgrade to the
current version 4.1.3. You may find that it fixes your problem.
You can download it here:
http://ftp.gnu.org/gnu/gawk/
2. The behavior of bracket expressions like [A-Z] depends on the locale.
Do you see the same problem in the C locale?
3. GNU Awk has character classes that can be used to avoid locale-sensitive
differences in behavior. They are documented in the distributed info and man
pages, and also here:
https://www.gnu.org/software/gawk/manual/html_node/Bracket-Expressions.html
> awk -F'[ :]' --re-interval '$1 ~ /^[A-Z][a-z]{3}$/{print $1}' lab3.data
This is better written as:
gawk -F'[ :]' --re-interval '$1 ~ /^[[:upper:]][[:lower:]]{3}$/{print $1}'
lab3.data
> awk -F'[ :]' --re-interval '$1 ~ /^[A-Z]{4}$/{print $1}' lab3.data
This should be:
gawk -F'[ :]' --re-interval '$1 ~ /^[[:upper:]]{4}$/{print $1}' lab3.data
Also, please note that --re-interval is the default behavior in current gawk,
so need not be specified.
Regards,
Andy