The awk utility can take its input from [[standard_input?]] or from files. If no input files are specified at the command line, then awk will take its input from [[standard_input?]].
In awk all input is separated into records and each record is sequentially processed according to the rules defined within the awk script. By default, each line of input is treated as a single [record] (or row of data).
In awk, records are further divided into fields, making them easy to manage, because processing can take place against a particular data field.
The awk utility reads its input files in the order provided and performs its [[pattern_matching?]] cycle until all lines of input have been read.
The getline command enables awk to take input from a particular file without the need to specify the filename as a command line parameter.
The following special variables are related to input:
*Variable* | *Description* |
FNR | An informative variable that provides the record number within the current file |
FS | A control variable that specifies the input field separator |
NF | An informative variable that provides the number of fields within the current record |
[[NR?]] | An informative variable that provides the total number of records processed |
RS | A control variable that specifies the input record separator |