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


/ Published in: Awk
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments


You need to login to view comments.