I have to add up rows and choose columns. I want to useFile1 2 31 21with no arguments the script should return6 (1st row)3 (2nd row)1 (3rd row)Here's the code for this part that I made:awk '{ for(i=1; i<=NF;i++) sum+=$i; print(sum); sum=0 }' $FILEwith argument 1 and 2 (number of columns), the script should add every row in column 1 and 2 so it should return:3 (1st+2nd column)3 (1st+2nd column)1 (1st+2nd (blank) column))The only thing that I need is a condition to sum only certain rows
How to add up certain columns using awk in unix script
awk