Operators' Precedence
It determines how operators are grouped when different operators appear in a single expression. For example, *
has higher precedence than +
. So, if we have a + b * c
;it means multiply b
and c
and then add a to the result. Precedence of operators can be overridden by using parentheses.
This is table of AWK's operator precedence order from highest to lowest:
Operator | Description |
| Grouping |
| Field reference |
| Increment, decrement |
| Exponentiation |
| Unary plus, minus, logical not |
| Multiplication, division or remainder |
| Addition, subtraction |
Space | String concatenation |
| Relational operators |
| Match and no match operator |
| Array membership |
| Logical and |
| Logical or |
| Ternary operator |
| Assignment operators group right to left |
Let us take a look at the following table to summarize the meaning of expression operators:
Operation | Operators | Example | Explanation of example |
Assignment |
|