This topic is about AWK – Unary Operators.
AWK supports the following unary operators −
Unary Plus
It is represented by +. It multiplies a single operand by +1.
Example
[jerry]$ awk 'BEGIN { a = -10; a = +a; print "a =", a }'
On executing this code, you get the following result −
Output
a = -10
Unary Minus
It is represented by -. It multiplies a single operand by -1.
Example
[jerry]$ awk 'BEGIN { a = -10; a = -a; print "a =", a }'
On executing this code, you get the following result −
Output
a = 10
In this topic we learned about AWK – Unary Operators. To know more, Click Here.
Pingback: AWK - Ternary Operator - Adglob Infosystem Pvt Ltd