Sample Header Ad - 728x90

Summing rows in a new column using sed, awk and perl?

6 votes
5 answers
1500 views
I have a file that contain numbers something like: 1 11 323 2 13 3 3 44 4 4 66 23 5 70 23 6 34 23 7 24 22 8 27 5 How can I sum the rows and output the results in a column, so the results are as follows: 1 11 323 335 2 13 3 18 3 44 4 51 4 66 23 93 5 70 23 98 6 34 23 63 7 24 22 53 8 27 5 40 I would like to see solutions in sed, awk, and perl
Asked by user311543
Sep 19, 2018, 03:07 PM
Last activity: Jul 14, 2025, 02:54 AM