Posted By

secdebian on 03/20/16


Tagged

print line awk replacing


Versions (?)

# print every line after replacing each field with its absolute value


 / Published in: Awk
 

  1. # print every line after replacing each field with its absolute value
  2. awk '{for (i=1; i<=NF; i++) if ($i < 0) $i = -$i; print }'
  3. awk '{for (i=1; i<=NF; i++) $i = ($i < 0) ? -$i : $i; print }'

Report this snippet  

You need to login to post a comment.