The following is a list of variables that awk sets automatically on certain occasions in order to provide information to your program. The variables that are specific to gawk are marked with a pound sign (#). These variables are gawk extensions. In other awk implementations or if gawk is in compatibility mode (see section Command-Line Options ), they are not special.
VARIABLE NAME | DESCRIPTION |
---|---|
FS | input field separator variable |
OFS | Output Field Separator |
RS | Input Record Separator variable |
ORS | Output Record Separator Variable |
NR | Number of Records |
NF | Number of Fields in a record |
FILENAME | Name of the current input file |
FNR | Number of Records relative to the current input file |
RLENGTH | length of the substring matched by the match() function |
RSTART | first position in the string matched by match() function |
FS - input field separator variable
It represents the (input) field separator and its default value is space. You can also change this by using -F command line option.