
Variable and Array Assignment | 775
gawk
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
Operators
The following table lists the operators, in order of increasing precedence, that are
available in awk.
While ** and **= are common extensions, they are not part of
POSIX awk.
Variable and Array Assignment
Variables can be assigned a value with an = sign. For example:
FS = ","
Expressions using the operators +, -, /, and % (modulo) can be assigned to
variables.
Arrays can be created with the split( ) function (described later), or they can
simply be named in an assignment statement. Array elements can be subscripted
with numbers (array[1],…,array[n]) or with strings. Arrays subscripted by
PROCINFO An array containing information about the process, such as real and effective UID
numbers, process ID number, and so on.
RT The text matched by RS, which can be a regular expression in gawk.
TEXTDOMAIN The text domain (application name) for internationalized messages ("messages").
Symbol Meaning
= += -= *= /= %= ^= **= Assignment.
?: C conditional expression.
|| Logical OR (short-circuit).
&& Logical AND (short-circuit).
in Array membership.
~ !~ Match regular expression and negation.
< <= > >= != == Relational operators.
(blank) Concatenation.
+ - Addition, subtraction.
* / % Multiplication, division, and modulus (remainder).
+ - ! Unary plus and minus, ...