$ cat file
x A 10 20 30
x B 5 10 12
x C 10 4 5
x D 10 3 6
x K 10 23 4
x M 5 7 0
Req o/p:
x A 15 30 42
x C 20 7 11
x K 15 30 4
Basically I want to add up 2 rows values as above.
I can sum the whole rows
$ awk '
{ for (i=3;i<=NF;++i) sum+=$i; j=NF}
END {for (i=3;i<=j;++i) printf "%s%s",OFS,sum}' file
50 67 57
Please help to add two rows values as I mentioned in my req o/p above, thanks.