[Bug 287948] Re: gawk-doc: example doesn't match actual output
Adrian Bunk
287948 at bugs.launchpad.net
Wed Jan 25 14:55:34 UTC 2017
This is fixed in 4.1.3-0.1 (in xenial and later), it now says:
Using an alphabetic character such as 'u' for the record separator is
highly likely to produce strange results. Using an unusual character
such as '/' is more likely to produce correct behavior in the majority
of cases, but there are no guarantees. The moral is: Know Your Data.
When using regular characters as the record separator, there is one
unusual case that occurs when 'gawk' is being fully POSIX-compliant
(*note Options::). Then, the following (extreme) pipeline prints a
surprising '1':
$ echo | gawk --posix 'BEGIN { RS = "a" } ; { print NF }'
-| 1
** Changed in: gawk-doc (Ubuntu)
Status: Confirmed => Fix Released
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gawk-doc in Ubuntu.
https://bugs.launchpad.net/bugs/287948
Title:
gawk-doc: example doesn't match actual output
Status in gawk:
Confirmed
Status in gawk-doc package in Ubuntu:
Fix Released
Bug description:
Binary package hint: gawk-doc
in (gawk.info.gz)Records, this example is given:
$ echo | awk 'BEGIN { RS = "a" } ; { print NF }'
1
But that's wrong: real results
peter at tesla:~$ echo | gawk 'BEGIN { RS = "a" } ; { print NF }'
0
peter at tesla:~$ echo | gawk --posix 'BEGIN { RS = "a" } ; { print NF }'
1
gawk 1:3.1.6.dfsg-0ubuntu1 on AMD64 pre-Intrepid.
I'm not sure what the best thing for the docs to say would be. I assume it's a bug in the docs, not in awk, but I'm not sure.
I'm still trying to figure out what the most concise way to read lines
from stdin, and feed them in batches of e.g. 10 lines to the stdin of
separate invocations of another command. Probably perl, since awk's
RS mechanism doesn't seem to be flexible enough. (I can do it in a
perl one-liner, but I was trying to shorten it, and awk's print |
command looks useful.)
To manage notifications about this bug go to:
https://bugs.launchpad.net/gawk/+bug/287948/+subscriptions
More information about the foundations-bugs
mailing list