UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 11.3 Patterns and ProceduresChapter 11
The awk Programming Language
Next: 11.5 Operators
 

11.4 Built-in Variables

VersionVariableDescription
awkFILENAME

Current filename

 FS

Field separator (a space)

 NF

Number of fields in current record

 NR

Number of the current record

 OFMT

Output format for numbers ("%.6g") and for conversion to string

 OFS

Output field separator (a space)

 ORS

Output record separator (a newline)

 RS

Record separator (a newline)

 $0

Entire input record

 $n

nth field in current record; fields are separated by FS

nawkARGC

Number of arguments on command line

 ARGV

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

 CONVFMT

String conversion format for numbers ("%.6g") (POSIX)

 ENVIRON

An associative array of environment variables

 FNR

Like NR, but relative to the current file

 RLENGTH

Length of the string matched by match() function

 RSTART

First position in the string matched by match() function

 SUBSEP

Separator character for array subscripts ("\034")

gawkARGIND

Index in ARGV of current input file

 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 calls to index()s ignore case

 RT

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


Previous: 11.3 Patterns and ProceduresUNIX in a Nutshell: System V EditionNext: 11.5 Operators
11.3 Patterns and ProceduresBook Index11.5 Operators

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System