Hi, does anyone know how to ignore whether a number is negative in a script. E.g. if I have a variable that contains -1200, how do I ignore the minus sign?
Do you mean absolute value?
echo '-1200' | awk '{ print ($1 >= 0) ? $1 : 0 - $1}'
Hi, does anyone know how to ignore whether a number is negative in a script. E.g. if I have a variable that contains -1200, how do I ignore the minus sign?
Do you mean absolute value?
echo '-1200' | awk '{ print ($1 >= 0) ? $1 : 0 - $1}'