I want to create a new column in my file that sums the values of the 2nd and 3rd column for each line. For example I want
1 2 3
4 5 6
7 8 9
to give me
1 2 3 5
4 5 6 11
7 8 9 17
I've seen other posts doing it with awk but I want to know if there is a way of doing it with loops so that it will read each line and perform the task and then move to the next line. I've saved my values into example.txt and tried the following but it didn't work:
for n in [ test1.txt | wc -l ]
do
test1.txt$2 + test1.txt$3 > test1.txt$4
done