Previous: Locales, Up: Expressions [Contents][Index]
awk supplies three kinds of constants: numeric, string, and
regexp. gawk lets you specify numeric constants in octal
and hexadecimal (bases 8 and 16) as well as decimal (base 10).
In certain contexts, a standalone regexp constant such as /foo/
has the same meaning as ‘$0 ~ /foo/’.
awk program, and a number
of others let you control how awk behaves.
awk. Numeric values are converted as if they were
formatted with sprintf() using the format in CONVFMT.
Locales can influence the conversions.
awk provides the usual arithmetic operators (addition,
subtraction, multiplication, division, modulus), and unary plus and minus.
It also provides comparison operators, Boolean operators, an array membership
testing operator, and regexp
matching operators. String concatenation is accomplished by placing
two expressions next to each other; there is no explicit operator.
The three-operand ‘?:’ operator provides an “if-else” test within
expressions.
awk, a value is considered to be true if it is nonzero
or non-null. Otherwise, the value is false.
awk provides
built-in and user-defined functions; this is described in
Functions.
awk’s operator
precedence is compatible with that of C.
awk
program, and occasionally the format for data read as input.
Previous: Locales, Up: Expressions [Contents][Index]