Simple Computational tricks

Tuesday, February 3, 2015

Checks column 2, 3 and 4 for any -ve value, and replaces it by +ve.

awk '{print $1, $2<0?$2*-1:$2, $3<0?$3*-1:$3, $4<0?$4*-1:$4}' file1 > file2
Posted by Ram Lal Awasthi at 1:09 PM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2020 (1)
    • ►  July (1)
  • ►  2018 (2)
    • ►  February (1)
    • ►  January (1)
  • ►  2016 (5)
    • ►  December (1)
    • ►  July (1)
    • ►  June (1)
    • ►  February (2)
  • ▼  2015 (5)
    • ▼  February (5)
      • Not so frequently used keywords c++
      • Change terminal work place to look like [02:43:14...
      • Checks column 2, 3 and 4 for any -ve value, and re...
      • awk '{ print $1,"\t" $2*10}' file.in > file.out
      • sed -n '0~10p' file.in > file.out
  • ►  2014 (3)
    • ►  June (1)
    • ►  January (2)
Awesome Inc. theme. Powered by Blogger.