With all the forms of
getline, even though
may be updated, the record will not be tested against all the patterns
awk program, in the way that would happen if the record
were read normally by the main processing loop of
the new record is tested against any subsequent rules.
awk implementations limit the number of pipelines an
program may have open to just one! In
gawk, there is no such limit.
You can open as many pipelines as the underlying operating system will
An interesting side-effect occurs if you use
getline (without a
redirection) inside a
BEGIN rule. Since an unredirected
reads from the command line data files, the first
awk to set the value of
FILENAME does not have a value inside
BEGIN rules, since you
have not yet started to process the command line data files (d.c.).
(See section The
END Special Patterns,
also see section Built-in Variables that Convey Information.)
The following table summarizes the six variants of
listing which built-in variables are set by each one.
getline < file
getline var < file
command | getline
command | getline var
Go to the first, previous, next, last section, table of contents.