Go to the first, previous, next, last section, table of contents.


Built-in Variables

gawk's built-in variables are:

ARGC
The number of elements in ARGV. See below for what is actually included in ARGV.
ARGIND
The index in ARGV of the current file being processed. When gawk is processing the input data files, it is always true that `FILENAME == ARGV[ARGIND]'.
ARGV
The array of command line arguments. The array is indexed from zero to ARGC - 1. Dynamically changing ARGC and the contents of ARGV can control the files used for data. A null-valued element in ARGV is ignored. ARGV does not include the options to awk or the text of the awk program itself.
CONVFMT
The conversion format to use when converting numbers to strings.
FIELDWIDTHS
A space separated list of numbers describing the fixed-width input data.
ENVIRON
An array of environment variable values. The array is indexed by variable name, each element being the value of that variable. Thus, the environment variable HOME is ENVIRON["HOME"]. One possible value might be `/home/arnold'. Changing this array does not affect the environment seen by programs which gawk spawns via redirection or the system function. (This may change in a future version of gawk.) Some operating systems do not have environment variables. The ENVIRON array is empty when running on these systems.
ERRNO
The system error message when an error occurs using getline or close.
FILENAME
The name of the current input file. If no files are specified on the command line, the value of FILENAME is the null string.
FNR
The input record number in the current input file.
FS
The input field separator, a space by default.
IGNORECASE
The case-sensitivity flag for string comparisons and regular expression operations. If IGNORECASE has a non-zero value, then pattern matching in rules, record separating with RS, field splitting with FS, regular expression matching with `~' and `!~', and the gensub, gsub, index, match, split and sub built-in functions all ignore case when doing regular expression operations, and all string comparisons are done ignoring case. The value of IGNORECASE does not affect array subscripting.
NF
The number of fields in the current input record.
NR
The total number of input records seen so far.
OFMT
The output format for numbers for the print statement, "%.6g" by default.
OFS
The output field separator, a space by default.
ORS
The output record separator, by default a newline.
RS
The input record separator, by default a newline. If RS is set to the null string, then records are separated by blank lines. When RS is set to the null string, then the newline character always acts as a field separator, in addition to whatever value FS may have. If RS is set to a multi-character string, it denotes a regexp; input text matching the regexp separates records.
RT
The input text that matched the text denoted by RS, the record separator.
RSTART
The index of the first character last matched by match; zero if no match.
RLENGTH
The length of the string last matched by match; -1 if no match.
SUBSEP
The string used to separate multiple subscripts in array elements, by default "\034".

See section Built-in Variables, for more information.


Go to the first, previous, next, last section, table of contents.