I have 20 files, with each file containing 19 columns and 3000 rows.
Now I want to sum over file 1~4, by keep the first column intact (first column are the same over all files), but sum column 2 to 19 over this four files. i.e. sum column 2,3,...,19 of file 1,2,3,4 over 3000 rows.
I have files DOS1 DOS2 ... DOS20.
How to do it simply?
I found a command like this works:
pr -m -t -s\ test1 test2 test3 | gawk '{print $1+$5+$9,$2+$6+$10,$3+$7+$11,$4+$8+$12}' > test4.dat
But, I have 19 columns to add, write them specifically is not neat. The test file is only 3 columns.
Thank you!