home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeBook TitleSearch this book

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



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.