bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] Wrong output in documentation example


From: Jeroen Schot
Subject: [bug-gawk] Wrong output in documentation example
Date: Mon, 23 Apr 2012 14:31:52 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Hello,

An Ubuntu user reported [1] a discrepancy between an example in the
manual and the actual command in section 4.1 [2].

[1]: https://bugs.launchpad.net/ubuntu/+source/gawk-doc/+bug/287948
[2]: http://www.gnu.org/software/gawk/manual/html_node/Records.html#Records

>From the manual:
| Using an unusual character such as ‘/’ for the record separator
| produces correct behavior in the vast majority of cases. However,
| the following (extreme) pipeline prints a surprising ‘1’:
|
|  $ echo | awk 'BEGIN { RS = "a" } ; { print NF }'
|  -| 1
|
| There is one field, consisting of a newline. The value of the
| built-in variable NF is the number of fields in the current record.

But using gawk 3.1.6, 3.1.7, 3.1.8 or 4.0.1 the example prints '0'.
Mawk and BWK's awk also print '0'.

Kind regards,

Jeroen Schot



reply via email to

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