[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gawk] gawk character class bug
From: |
Ed Morton |
Subject: |
[bug-gawk] gawk character class bug |
Date: |
Thu, 7 Mar 2013 18:00:01 +0000 (UTC) |
There's a bug in gawk wrt issuing a warning for character classes being used in
a bracket expression. I want to remove the first character in a string that's
either a closing square bracket "]" or a space "[:space:]".In
/usr/xpg4/bin/awk on Solaris I can do this:
$ echo "a]b" | /usr/xpg4/bin/awk '{sub(/[][:space:]]/,"")}1'
ab
In gawk it works just fine too and does correctly understand that [:space:] is
a character class BUT I get an unwarranted warning message:
$ echo "a]b" | gawk '{sub(/[][:space:]]/,"")}1'
gawk: cmd. line:1: warning: regexp component `[:space:]' should probably be
`[[:space:]]'
ab
See the discussion at
https://groups.google.com/forum/#!topic/comp.lang.awk/MGX4VKyuv0k for more
info.
Regards,
Ed Morton.
- [bug-gawk] gawk character class bug,
Ed Morton <=