Awk takes its arithmetic operators from the C programming language. The following list describes what each one does.
| Name | Function of Arithmetic Operation |
|---|---|
| * | Multiplies the expression preceding the operator by the expression following it. |
| / | Divides the expression preceding the operator by the expression following it. |
| % | Takes the remainder after dividing the expression preceeding the operator by the expression following it. |
| + | Adds the expression preceeding the operator and the expression following it. |
| - | Subtracts the expression preceeding the operator and the expression following it. |
| = | Assigns the value of the expression following the operator to the variable preceeding it. |
| ++ | Increments the variable preceeding the operator. |
| -- | Decrements the variable preceeding the operator. |
| += | Adds the expression following the operator to the variable preceeding it and assigns the result to the variable preceeding the operator. |
| -= | Subtracts the expression following the operator to the variable preceeding it and assigns the result to the variable preceeding the operator. |
| *= | Multiplies the variable preceeding the operator by the expression following it and assigns the result to the variable preceeding the operator. |
| /= | Divides the variable preceeding the operator by the expression following it and assigns the result to the variable preceeding the operator. |
| %= | Takes the remainder, after dividing the variable preceeding the operator by the expression following it, and assigns the result to the variable preceeding the operator. |