HP-UX Reference (11i v1 05/09) - 1 User Commands A-M (vol 1)

a
awk(1) awk(1)
A pattern can consist of two patterns separated by a comma; in this case, the action is performed for all
lines from an occurrence of the first pattern though an occurrence of the second.
A relational expression is one of the following:
expression matchop regular-expression
expression relop expression
expression in array-name
(expr,expr,...
) in array-name
where a relop is any of the six relational operators in C, and a matchop is either
˜ (matches) or (does
not match). A conditional is an arithmetic expression, a relational expression, or a Boolean combination of
the two.
The special patterns
BEGIN and END can be used to capture control before the first input line is read and
after the last. BEGIN and END do not combine with other patterns.
Special Characters
The following special escape sequences are recognized by
awk in both regular expressions and strings:
Escape Meaning
\a alert character
\b backspace character
\f form-feed character
\n new-line character
\r carriage-return character
\t tab character
\v vertical-tab character
\nnn 1- to 3-digit octal value nnn
\xhhh 1- to n-digit hexadecimal number
Variable Names
Variable names with special meanings are:
FS Input field separator regular expression; a space character by default; also settable
by option -Ffs.
NF The number of fields in the current record.
NR The ordinal number of the current record from the start of input. Inside a BEGIN
action the value is zero. Inside an END action the value is the number of the last
record processed.
FNR The ordinal number of the current record in the current file. Inside a BEGIN
action the value is zero. Inside an END action the value is the number of the last
record processed in the last file processed.
FILENAME A pathname of the current input file.
RS The input record separator; a newline character by default.
OFS The print statement output field separator; a space character by default.
ORS The print statement output record separator; a newline character by default.
OFMT Output format for numbers (default %.6g). If the value of OFMT is not a
floating-point format specification, the results are unspecified.
CONVFMT Internal conversion format for numbers (default %.6g). If the value of CONVFMT
is not a floating-point format specification, the results are unspecified.
Refer to the UNIX95 variable under EXTERNAL INFLUENCES for additional
information on CONVFMT.
SUBSEP The subscript separator string for multi-dimensional arrays; the default value is
"\034"
ARGC The number of elements in the ARGV array.
ARGV An array of command line arguments, excluding options and the program argu-
ment numbered from zero to ARGC-1.
Section 136 Hewlett-Packard Company 3 HP-UX 11i Version 1: September 2005