diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-08-05 17:33:52 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-08-05 17:33:52 +0300 |
commit | f60abc38c224e5a56aef64564d37f5f6ef7e87a9 (patch) | |
tree | 9a071b3f6ec699662dc39a427243da3bc48a8324 /doc/gawk.texi | |
parent | c6454cc02a0c79c3da5316aa580e545c8e7085f0 (diff) | |
download | egawk-f60abc38c224e5a56aef64564d37f5f6ef7e87a9.tar.gz egawk-f60abc38c224e5a56aef64564d37f5f6ef7e87a9.tar.bz2 egawk-f60abc38c224e5a56aef64564d37f5f6ef7e87a9.zip |
Fix doc on RS = "a" case.
Diffstat (limited to 'doc/gawk.texi')
-rw-r--r-- | doc/gawk.texi | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/doc/gawk.texi b/doc/gawk.texi index 91ef044c..b2044649 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -5256,16 +5256,22 @@ awk '@{ print $0 @}' RS="/" BBS-list This sets @code{RS} to @samp{/} before processing @file{BBS-list}. Using an unusual character such as @samp{/} for the record separator -produces correct behavior in the vast majority of cases. However, -the following (extreme) pipeline prints a surprising @samp{1}: +produces correct behavior in the vast majority of cases. + +There is one unusual case, that occurs when @command{gawk} is +being fully POSIX-compliant (@pxref{Options}). +Then, the following (extreme) pipeline prints a surprising @samp{1}: @example -$ echo | awk 'BEGIN @{ RS = "a" @} ; @{ print NF @}' +$ echo | gawk --posix 'BEGIN @{ RS = "a" @} ; @{ print NF @}' @print{} 1 @end example There is one field, consisting of a newline. The value of the built-in variable @code{NF} is the number of fields in the current record. +(In the normal case, @command{gawk} treats the newline as whitespace, +printing @samp{0} as the result. Most other versions of @command{awk} +also act this way.) @cindex dark corner, input files Reaching the end of an input file terminates the current input record, |