[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Wrong output in documentation example
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] Wrong output in documentation example |
Date: |
Sun, 05 Aug 2012 17:36:46 +0300 |
User-agent: |
Heirloom mailx 12.4 7/29/08 |
Hi. Apologies for the long delay in replying.
First, thanks for this report.
Second, thanks to address@hidden who also reported this (more recently).
> Date: Mon, 23 Apr 2012 14:31:52 +0200
> To: address@hidden
> From: Jeroen Schot <address@hidden>
> Subject: [bug-gawk] Wrong output in documentation example
>
> 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
This was a bit of a puzzler to figure out. :-)
I have just pushed a change to the gawk-4.0-stable branch. The doc
now indicates that gawk prints a 1 only in POSIX mode, since in that
case, newline is not whitespace.
Thanks again,
Arnold
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [bug-gawk] Wrong output in documentation example,
Aharon Robbins <=