Operators
The following table lists the operators, in order of increasing precedence, that are available in awk.
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, and logical negation. |
^ ** | Exponentiation. |
++ -- | Increment and decrement, either prefix or postfix. |
$ | Field reference. |
Tip
While ** and **= are common extensions, they are not part of POSIX awk.
Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.