apend last record in input file with the sum of two fields
Posted: Wed Sep 28, 2016 10:39 am
Hi All,
My requirement is that I need to append one record in the output file in which the first five characters is "total" word and in other fields the sum of two fields from the input file.
EG:-
THIS IS MY INPUT FILE
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
23/03/2016 10 34 /*FILE 1*/
24/04/2016 20 56 /*FILE 2*/
26/08/2016 30 85 /*FILE 3*/
.
.
.
.
.
AND I NEED OUTPUT FILE LIKE THIS
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
23/03/2016 10 34 /*FILE 1*/
24/04/2016 20 56 /*FILE 2*/
26/08/2016 30 85 /*FILE 3*/
.
.
.
.
.
TOTAL 60 175
My requirement is that I need to append one record in the output file in which the first five characters is "total" word and in other fields the sum of two fields from the input file.
EG:-
THIS IS MY INPUT FILE
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
23/03/2016 10 34 /*FILE 1*/
24/04/2016 20 56 /*FILE 2*/
26/08/2016 30 85 /*FILE 3*/
.
.
.
.
.
AND I NEED OUTPUT FILE LIKE THIS
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
23/03/2016 10 34 /*FILE 1*/
24/04/2016 20 56 /*FILE 2*/
26/08/2016 30 85 /*FILE 3*/
.
.
.
.
.
TOTAL 60 175