I have a file on the following format
id_1,1,0,2,3,lable1 id_2,3,2,2,1,lable1 id_3,5,1,7,6,lable1
and I want the summation of each column ( I
A modified version based on the solution you linked:
#!/bin/bash colnum=6 filename="temp" for ((i=2;i<$colnum;++i)) do sum=$(cut -d ',' -f $i $filename | paste -sd+ | bc) echo -n $sum',' done head -1 $filename | cut -d ',' -f $colnum