AnsweredAssumed Answered

Summation based on few fields

Question asked by jananand746992 on Feb 15, 2018
Latest reply on Feb 15, 2018 by britto.parthalomew

I have a file with 5 records

D1,L1,A1,300,100
D1,L1,A1,200,600
D1,L1,A1,300,100
D2,L1,A1,300,
D2,L1,A1,,300

 

i need only 2 records in output.  based on first 3 fields, field 4 and field 5 should be summed up.

In the above case, first 3 lines have D1,L1 and A1 in the first 3 fields. Hence we need to add field 4 on all 3 lines -which is 800 and similarly field 5.

last 2 lines have same same first 3 fields and hence field 4 and 5 should be summed up.

 

D1,L1,A1,800,800
D2,L1,A1,300,300

 

Any help in solving is highly appreciated.

 

TIA

Outcomes