I have this file:
1 2
2 7
3 4
4 7
5 3
6 7
7 1
8 2
9 4
And my desired output is
1 13
2 17
3 7
In my input i have 9 rows and i want to reduce it to three rows while preserving the total amount of 2nd column. For example 1 in 1st column represnts 1,2,3 and 13 in 2nd column, 1st row represent addition (2+4+7) and so on.. Any idea? may be by using awk/ perl or any other linux tool.