[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Debian awk and mawk substr bug (was semicolon bug)
From: |
Alex Potanin |
Subject: |
Debian awk and mawk substr bug (was semicolon bug) |
Date: |
Mon, 13 Sep 2004 12:25:21 -0500 |
User-agent: |
Mozilla Thunderbird 0.5 (X11/20040306) |
Hello,
Chapman Flack wrote:
Are you sure it is not a length() or substr() bug, rather than a (less likely)
bug specific to semicolons? Notice that the lines you give as input to awk
differ between the two examples below; in the second example there is no
semicolon on the first line of input. The second example behavior is
therefore consistent with an interpretation that length() or substr() is
simply off by one, nothing to do with semicolons.
-Chap
Yes, sorry.
It appears to be substr() bug in Debian's *mawk* and Debian's *awk*. Not
semicolon related and length returns the right value.
address@hidden:~/Purdue/CVSData/OpenVM$ /usr/bin/awk '{ print substr($0,
0, length($0) - 6) } '
somestring123456
somestrin
address@hidden:~/Purdue/CVSData/OpenVM$ /usr/bin/mawk '{ print
substr($0, 0, length($0) - 6) } '
somestring123456
somestrin
address@hidden:~/Purdue/CVSData/OpenVM$ /usr/local/bin/awk '{ print
substr($0, 0, length($0) - 6) } '
somestring123456
somestring
Cheers,
Alex.
------------------------------------------------------------
Alex Potanin
PhD Student
SMCS, VUW
Office: +64 (4) 463 5302
Mobile: +64 (21) 737 654
http://www.mcs.vuw.ac.nz/~alex/
------------------------------------------------------------