I have a file like this:
ID Category Sample1 Sample2 Sample3
1 A 5 5 5
2 A 5 5 5
3 A 5 5 5
4 B 1 2 3
5 B 1 2 3
And I'm looking for an awk, sed or similar solution to achieve this:
ID Category Sample1 Sample2 Sample3
1 A 15 15 15
4 B 2 4 6
The idea is to sum rows of matching categories, considering the values of each sample column and remove the repeated IDs.
data1.txt:
Code:
Output:
And with data1.txt:
Output:
%results
: