(gawk.info.gz) Getline Notes
Info Catalog
(gawk.info.gz) Getline/Variable/Coprocess
(gawk.info.gz) Getline
(gawk.info.gz) Getline Summary
3.8.9 Points to Remember About `getline'
----------------------------------------
Here are some miscellaneous points about `getline' that you should bear
in mind:
* When `getline' changes the value of `$0' and `NF', `awk' does
_not_ automatically jump to the start of the program and start
testing the new record against every pattern. However, the new
record is tested against any subsequent rules.
* Many `awk' implementations limit the number of pipelines that an
`awk' program may have open to just one. In `gawk', there is no
such limit. You can open as many pipelines (and coprocesses) as
the underlying operating system permits.
* An interesting side effect occurs if you use `getline' without a
redirection inside a `BEGIN' rule. Because an unredirected
`getline' reads from the command-line data files, the first
`getline' command causes `awk' to set the value of `FILENAME'.
Normally, `FILENAME' does not have a value inside `BEGIN' rules,
because you have not yet started to process the command-line data
files. (d.c.) ( BEGIN/END, also Auto-set.)
* Using `FILENAME' with `getline' (`getline < FILENAME') is likely
to be a source for confusion. `awk' opens a separate input stream
from the current input file. However, by not using a variable,
`$0' and `NR' are still updated. If you're doing this, it's
probably by accident, and you should reconsider what it is you're
trying to accomplish.
Info Catalog
(gawk.info.gz) Getline/Variable/Coprocess
(gawk.info.gz) Getline
(gawk.info.gz) Getline Summary
automatically generated by
info2html