I have this output filename.txt
AC1481523 001 001 001 001
AC1481523 005 005 005 005
AC1481676 003 003 005 004
AC1481676 003 002 001 004
I want to add all the columns separately where the first column has the same value. I tried this
awk '{for (j = 1; j <= 200; j++) a[$1]+=$j} END {for(i in a) print i,a[i] }' filename.txt
I get all the numbers added in a single column, and I get
AC1481523 24
AC1481676 25
But I want
AC1481523 6 6 6 6
AC1481676 6 5 6 8