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 Scripting Language
Next: 11.5 Operators
 

11.4 Awk System Variables

VersionVariableDescription
awkFILENAMECurrent filename.
FSField separator (default is a blank).
NFNumber of fields in current record.
NRNumber of the current record.
OFSOutput field separator (default is a blank).
ORSOutput record separator (default is a newline).
RSRecord separator (default is a newline).
$0Entire input record.
$n

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

nawkARGCNumber of arguments on command line.
ARGVAn array containing the command-line arguments.
FNRLike NR, but relative to the current file.
OFMTOutput format for numbers (default is %.6g).
RSTARTFirst position in the string matched by match function.
RLENGTHLength of the string matched by match function.
SUBSEPSeparator character for array subscripts (default is \034).
gawkENVIRONAn associative array of environment variables.
IGNORECASEAn associative array of environment variables.


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