Download raw body.
awk.1: Fix description of getline
In awk.1, the description of the various forms of the getline
function is confused. _The AWK Programming Language_, second
edition, sums it up in this table (p. 204):
TABLE A-10. GETLINE FUNCTION
===================================
Expression | Sets
------------------+----------------
getline | $0, NF, NR, FNR
getline var | var, NR, FNR
getline <file | $0, NF
getline var <file | var
cmd | getline | $0, NF
cmd | getline var | var
------------------+----------------
Here's a minimal diff to rectify the description.
OK?
diff /usr/src
path + /usr/src
commit - 96d2c82cdceb02b2a47cd4a061a37a610b190481
blob - 9fa1b4b5da044e334433e2123e855f3770c1ebe6
file + usr.bin/awk/awk.1
--- usr.bin/awk/awk.1
+++ usr.bin/awk/awk.1
@@ -790,12 +790,11 @@ is omitted.
.Fa expr
should match the string that was used to open the file or pipe.
.It Ic getline
-Sets
-.Va $0
-to the next input record from the current input file.
+Reads the next record from the current input file.
This form of
.Ic getline
sets the variables
+.Va $0 ,
.Va NF ,
.Va NR ,
and
@@ -803,13 +802,11 @@ and
.Ic getline
returns 1 for a successful input, 0 for end of file, and \-1 for an error.
.It Ic getline Va var
-Sets
-.Va $0
-to variable
-.Va var .
+Reads the next record from the current input file.
This form of
.Ic getline
sets the variables
+.Va var ,
.Va NR
and
.Va FNR .
@@ -819,9 +816,7 @@ returns 1 for a successful input, 0 for end of file, a
.Ic getline Op Va var
.Pf <\ \& Ar file
.Xc
-Sets
-.Va $0
-to the next record from
+Reads the next record from
.Ar file .
If
.Va var
--
Christian "naddy" Weisgerber naddy@mips.inka.de
awk.1: Fix description of getline