I need to write a shell script to merge csv files. Both the files have same columns with fixed number of columns designated as "Keys". If the Keys are same, then I want to merge them by adding the non key columns.
For example:
A.csv
k1,k2,k3,v1,v2 => This is the header row
A,B,C,4,5
A,B,D,3,4
B.csv
k1,k2,k3,v1,v2 => This is the header row
A,B,A,2,3
A,B,C,1,4
A,B,E,4,5
Merged.csv:
k1,k2,k3,v1,v2 => This is the header row
A,B,A,2,3
A,B,C,5,9 => A,B,C is present in both the csv, so value cols are added
A,B,D,3,4
A,B,E,4,5