Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

User Commands (a - b) awk(1)
from command. In all cases, getline returns 1 for a successful input, 0 (zero) for End-of-File, and
-1 for an error.
Patterns
Patterns are arbitrary Boolean combinations of patterns and relational expressions (the !, |, and &
operators and parentheses for grouping). You must start and end regular expressions with
slashes. You can use regular expressions as described for the grep command, including the fol-
lowing special characters:
+ One or more occurrences of the pattern.
? Zero or one occurrence of the pattern.
Either of two statements.
() Grouping of expressions.
Isolated regular expressions in a pattern apply to the entire line. Regular expressions can occur
in relational expressions. Any string (constant or variable) can be used as a regular expression,
except in the position of an isolated regular expression in a pattern.
If two patterns are separated by a comma, the action is performed on all lines between an
occurrence of the rst pattern and the next occurrence of the second.
Regular expressions can contain extended (multibyte) characters with one exception: range con-
structs in character class specications using brackets cannot contain multibyte extended charac-
ters. Individual instances of extended (multibyte) characters can appear within brackets; how-
ever, extended characters are treated as separate one-byte characters.
Inclusion of extended characters in ranges is determined by the collating sequence as dened by
the current locale. The wild-card characters , +, and ? match characters and character strings, not
bytes.
There are two types of relational expressions you can use. The rst type has the form:
expression match_operator pattern
where match_operator is either: ˜ (for contains)or!˜ (for does not contain).
The second type has the form:
expression relational_operator expression
where relational_operator is any of the six C relational operators: <, >, <=, >=, ==, and !=.A
conditional can be an arithmetic expression, a relational expression, or a Boolean combination of
these expressions.
You can use the BEGIN and END special patterns to capture control before the rst and after the
last input line is read, respectively. BEGIN must be the rst pattern; END must be the last.
BEGIN and END do not combine with other patterns.
You have two ways to designate a character other than white space to separate elds. You can
use the -Fcharacter ag on the command line, or you can start program with the following
sequence:
BEGIN { FS = c }
Either action changes the eld separator to c.
527188-004 Hewlett-Packard Company 125