I need to merge the two files into one file with only one header and one trilaer record and the trailer record should have the sum of both the first file and the second file. For example, file 1 has trailer record with total marks in maths as (25 + 30) = 55 and file 2 has total marks in maths as (15+45) = 60 . So the merged file has the marks in maths in the trailer record as 115 which is the sum of all marks.
Should I use 'sum' to sum the fileds up?
The file length is 32 (15+5+3+6+3)
pat maths 25 science 40
mark maths 30 science 50
Trevor maths 15 science 30
Stephen maths 45 science 40
trailer maths 115 science 160