Portanto, tenho um arquivo grande que contém valores de contagem em colunas. Uma versão mais curta do arquivo é a seguinte:
Id,Sample1,Sample2,Sample3,Sample4,Sample5,Sample6,Sample7,Sample8,Sample9,Sample10,Sample11,Sample12,Sample13,Sample14,Sample15,Sample16,Sample17,Sample18,Sample19,Sample20,Sample21,Sample22,Sample23,Sample24
bar,80,167,1419,2973,16846,31523,257,466,4004,6662,13862,22205,116,284,786,1198,467,853,3333,6054,18122,34030,22,41
foo,29,71,582,1143,6382,11466,99,138,1388,2176,4337,7043,55,106,349,600,211,319,1468,2418,8661,15285,12,12
qaz,23,59,478,904,4919,8538,85,147,1553,2463,5061,8094,56,84,271,411,176,291,1268,2132,7219,12436,6,13
etc,27,43,464,970,4101,8092,90,111,1441,2174,4954,7940,41,85,249,378,130,234,1075,1856,5920,10854,9,18
zxc,15,34,332,609,2568,4652,53,82,989,1592,3219,5034,46,87,315,479,104,170,759,1297,4926,8171,2,9
qwe,9,20,146,310,2932,5391,48,94,842,1349,2823,4430,23,34,115,235,113,172,811,1362,4178,7576,8,10
asd,16,39,388,687,2796,5303,51,110,763,1216,2610,4165,50,79,351,603,113,156,824,1345,3337,6168,4,9
abc,6,16,91,192,385,654,21,32,326,496,7884,12266,10,19,56,89,41,62,251,367,1545,2657,,4
xyz,14,33,249,538,1634,2983,28,71,555,952,1697,2712,23,34,111,167,95,148,650,1131,3204,5814,4,12
O que eu gostaria de fazer é somar colunas consecutivas (sample1 + sample2, sample3 + sample4, ...) de forma que:
bar,247,4392,...
foo,100,1725,...
qaz,82,1382,...
...
Eu tentei fazer loops sobre NF, mas parece que imprime tudo em linhas separadas, e os números também não são precisos ...
> awk -F, 'NR > 1 {for(i=2; i<=NF; i=i+2){print ($i + $i+1)}}' short.csv
161
2839
33693
515
8009
27725
233
1573
935
6667
36245
45
59
1165
...
É possível fazer isso em awk ou similar leve, script de linha de comando?