gawk: Input Summary

1 
1 4.14 Summary
1 ============
1 
1    * Input is split into records based on the value of 'RS'.  The
1      possibilities are as follows:
1 
1      Value of 'RS'      Records are split on      'awk' / 'gawk'
1                         ...
1      ---------------------------------------------------------------------------
1      Any single         That character            'awk'
1      character
1      The empty string   Runs of two or more       'awk'
1      ('""')             newlines
1      A regexp           Text that matches the     'gawk'
1                         regexp
1 
1    * 'FNR' indicates how many records have been read from the current
1      input file; 'NR' indicates how many records have been read in
1      total.
1 
1    * 'gawk' sets 'RT' to the text matched by 'RS'.
1 
1    * After splitting the input into records, 'awk' further splits the
1      records into individual fields, named '$1', '$2', and so on.  '$0'
1      is the whole record, and 'NF' indicates how many fields there are.
1      The default way to split fields is between whitespace characters.
1 
1    * Fields may be referenced using a variable, as in '$NF'.  Fields may
1      also be assigned values, which causes the value of '$0' to be
1      recomputed when it is later referenced.  Assigning to a field with
1      a number greater than 'NF' creates the field and rebuilds the
1      record, using 'OFS' to separate the fields.  Incrementing 'NF' does
1      the same thing.  Decrementing 'NF' throws away fields and rebuilds
1      the record.
1 
1    * Field splitting is more complicated than record splitting:
1 
1      Field separator value         Fields are split ...          'awk' /
1                                                                  'gawk'
1      ---------------------------------------------------------------------------
1      'FS == " "'                   On runs of whitespace         'awk'
1      'FS == ANY SINGLE             On that character             'awk'
1      CHARACTER'
1      'FS == REGEXP'                On text matching the regexp   'awk'
1      'FS == ""'                    Such that each individual     'gawk'
1                                    character is a separate
1                                    field
1      'FIELDWIDTHS == LIST OF       Based on character position   'gawk'
1      COLUMNS'
1      'FPAT == REGEXP'              On the text surrounding       'gawk'
1                                    text matching the regexp
1 
1    * Using 'FS = "\n"' causes the entire record to be a single field
1      (assuming that newlines separate records).
1 
1    * 'FS' may be set from the command line using the '-F' option.  This
1      can also be done using command-line variable assignment.
1 
1    * Use 'PROCINFO["FS"]' to see how fields are being split.
1 
1    * Use 'getline' in its various forms to read additional records from
1      the default input stream, from a file, or from a pipe or coprocess.
1 
1    * Use 'PROCINFO[FILE, "READ_TIMEOUT"]' to cause reads to time out for
1      FILE.
1 
1    * Directories on the command line are fatal for standard 'awk';
1      'gawk' ignores them if not in POSIX mode.
1