awksupplies three kinds of constants: numeric, string, and regexp.
gawklets 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/’.
awkprogram, and a number of others let you control how
awk. Numeric values are converted as if they were formatted with
sprintf()using the format in
CONVFMT. Locales can influence the conversions.
awkprovides 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.
awkprovides built-in and user-defined functions; this is described in Functions.
awk’s operator precedence is compatible with that of C.
awkprogram, and occasionally the format for data read as input.