Help in adding in csv file

Hi experts
I have a .csv file which contains
the csv is comma seperated file
col1 col2
1 2
3 4
5 6
7 8

I want the colums to be added and the output must be

col1 col2 col3
1 2 3
3 4 7
5 6 11
7 8 15

Please help:(

$ nawk  'BEGIN { FS=","; OFS="," } NR == 1 { print $1,$2,"col3" } NR > 1 { print $1,$2,$1+$2} ' inputfile
col1,col2,col3
1,2,3
3,4,7
5,6,11
7,8,15

If your field separator is really blank, as shown in your example, just remove the BEGIN-block.

$ nawk  'NR == 1 { print $1,$2,"col3" } NR > 1 { print $1,$2,$1+$2} ' inputfile
col1 col2 col3
1 2 3
3 4 7
5 6 11
7 8 15
1 Like