Dear stackOverflow community, Here is the code from cut&tag tutorial text. I can't understand the meaning of the code for awk user defined function,
awk -F'\t' 'function abs(x){return ((x < 0.0) ? -x : x)} {print abs($9)}'
Any help would be appreciated!
It's the conditional operator. x ? y : z
is mostly equivalent to if (x) { y } else { z }
This means the function is equivalent to:
function abs(x){if(x < 0.0) { return -x; } else { return x; }}