Open System Services Shell and Utilities Reference Manual (G06.28+, H06.05+)
nawk(1) OSS Shell and Utilities Reference Manual
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 first pattern and the next occurrence of the second.
Regular expressions can contain extended (multibyte) characters with one exception: range con-
structs in character class specifications 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 defined 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 first 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 first and after the
last input line is read, respectively. BEGIN must be the first 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 fields. You can
use the -Fcharacter flag on the command line, or you can start program with the following
sequence:
BEGIN { FS = c }
Either action changes the field separator to c.
6−34 Hewlett-Packard Company 527188-007