Thursday 15 September 2011

subtracting data from columns in bash csv -


I have several columns in one file, I want to subtract two columns ...

This form ... without a decimal ....

  1.000 900 1.012 1.010 1.015 1.005 1.020 1.010  

Let me count one more file in the same file Column is required

  100 2 10 10  

I have tried

  awk - F "," $ $ 16 = $ 4- $ 2; Print $ 1 "," $ 2 "," $ 3 "," $ 4 "," $ 5 "," $ 6} ' 

but it gives me ... < / P>

  0.100 0.002 0.010 0.010  

Any sign?

Use this awk :

 < Code> awk -v OFS = '\ t' '{p = $ 1; Q = $ 2; Sub (/ /., "", P); Sub (/ /. / "," ", Q); Print $ 0, (p-Q)} 'file 1.000 900 100 1.012 1.010 2 1.015 1.005 10 1.020 1.010 10  

No comments:

Post a Comment