Hi, I'm really new at awk/gawk/nawk and need help with what must be a simple problem, I have a test-inputdata set like this:
1 1
1 2
1 5
2 5
2 6
2 7
3 2
3 3
3 4
.
.
.
500 9
500 2
500 3
and I want the sum of all data with the same $1 (in other words when $1=1 sum up 1+2+5 (=8), when $1=2 sum up 5+6+7 (=18), etc... finally when $1=500 sum up 9+2+3 (=14)). I want the output to be:
1 8
2 18
3 9
.
.
.
500 14
thank you!!!
1 1
1 2
1 5
2 5
2 6
2 7
3 2
3 3
3 4
.
.
.
500 9
500 2
500 3
and I want the sum of all data with the same $1 (in other words when $1=1 sum up 1+2+5 (=8), when $1=2 sum up 5+6+7 (=18), etc... finally when $1=500 sum up 9+2+3 (=14)). I want the output to be:
1 8
2 18
3 9
.
.
.
500 14
thank you!!!