RS. The possibilities are as follows:
||Records are split on …|
|Any single character||That character|
|The empty string (
||Runs of two or more newlines|
|A regexp||Text that matches the regexp|
FNRindicates how many records have been read from the current input file;
NRindicates how many records have been read in total.
RTto the text matched by
awkfurther splits the records into individual fields, named
$2, and so on.
$0is the whole record, and
NFindicates how many fields there are. The default way to split fields is between whitespace characters.
$NF. Fields may also be assigned values, which causes the value of
$0to be recomputed when it is later referenced. Assigning to a field with a number greater than
NFcreates the field and rebuilds the record, using
OFSto separate the fields. Incrementing
NFdoes the same thing. Decrementing
NFthrows away fields and rebuilds the record.
|Field separator value||Fields are split …|
||On runs of whitespace|
||On that character|
||On text matching the regexp|
||Such that each individual character is a separate field|
||Based on character position|
||On the text surrounding text matching the regexp|
FS = "\n"’ causes the entire record to be a single field (assuming that newlines separate records).
FSmay be set from the command line using the
-Foption. This can also be done using command-line variable assignment.
PROCINFO["FS"]to see how fields are being split.
getlinein its various forms to read additional records from the default input stream, from a file, or from a pipe or coprocess.
PROCINFO[file, "READ_TIMEOUT"]to cause reads to time out for
gawkignores them if not in POSIX mode.