Skip to main content
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

As @terdon's answeranswer but without the sed:

awk '{ for(i=1;i<=NF;i+=2){ if ($i<0) $(i+1)*=-1; $i = ""; } print }' 

As @terdon's answer but without the sed:

awk '{ for(i=1;i<=NF;i+=2){ if ($i<0) $(i+1)*=-1; $i = ""; } print }' 

As @terdon's answer but without the sed:

awk '{ for(i=1;i<=NF;i+=2){ if ($i<0) $(i+1)*=-1; $i = ""; } print }' 
Source Link
meuh
  • 54.7k
  • 2
  • 70
  • 138

As @terdon's answer but without the sed:

awk '{ for(i=1;i<=NF;i+=2){ if ($i<0) $(i+1)*=-1; $i = ""; } print }'