Section 11.4. Built-in Variables


11.4. Built-in Variables

All awk variables are included in gawk.

Version

Variable

Description

awk

ARGC

Number of arguments on the command line.

 

ARGV

An array containing the command-line arguments, indexed from 0 to ARGC - 1.

 

ENVIRON

An associative array of environment variables.

 

FILENAME

Current filename.

 

FNR

Like NR, but relative to the current file.

 

FS

Field separator (a space).

 

NF

Number of fields in current record.

 

NR

Number of the current record.

 

OFMT

Output format for numbers ("%.6g").

 

OFS

Output field separator (a space).

 

ORS

Output record separator (a newline).

 

RLENGTH

Length of the string matched by match( ) function.

 

RS

Record separator (a newline).

 

RSTART

First position in the string matched by match( ) function.

 

SUBSEP

Separator character for array subscripts ("\034").

 

$0

Entire input record.

 

$n

nth field in current record; fields are separated by FS.

gawk

ARGIND

Index in ARGV of current input file.

 

BINMODE

Controls binary I/O for input and output files. Use values of 1, 2, or 3 for input, output, or both kinds of files, respectively. Set it on the command line to affect standard input, standard output, and standard error.

 

ERRNO

A string indicating the error when a redirection fails for getline or if close( ) fails.

 

FIELDWIDTHS

A space-separated list of field widths to use for splitting up the record, instead of FS.

 

IGNORECASE

When true, all regular expression matches, string comparisons, and index( ) ignore case.

 

LINT

Dynamically controls production of "lint" warnings. With a value of "fatal", lint warnings become fatal errors.

 

PROCINFO

An array containing information about the process, such as real and effective UID numbers, process ID number, and so on.

 

RT

The text matched by RS, which can be a regular expression in gawk.

 

TEXTDOMAIN

The text domain (application name) for internationalized messages ("messages").




Linux in a Nutshell
Linux in a Nutshell
ISBN: 0596154488
EAN: 2147483647
Year: 2004
Pages: 147

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net