Tuesday, 3 September 2013

sum same column across multiple files using awk ?

sum same column across multiple files using awk ?

i want to add the 3rd column of 5 files such that the new file will have
the same 2nd col and the sum of the 3rd col of the 5 files i tried
something like $ cat freqdat044.dat | awk '{n=$3; getline
<"freqdat046.dat";print $2" " n+$3}' > freqtrial1.dat
freqdat048.datenter code here$ cat freqdat044.dat | awk '{n=$3; getline
<"freqdat046.dat";print $2" " n+$3}' > freqtrial1.dat the files names
freqdat044.dat freqdat045.dat freqdat046.dat freqdat047.dat freqdat049.dat
freqdat050.dat
and saved in output file the contain only $2 and the new col form the
summation of the 3rd

No comments:

Post a Comment