Hi..
I am facing a problem in aggregating some CSV data, using Java. I am not able to figure out how to aggregate the common values.
My input is like this:
G01,38020, XX, 3M EUR, Sep-07,10,23
G01,38020, XX, 3M EUR, Sep-07,11, ,72
G01,38020, XX, 3M EUR, Dec-07,14, ,500
My expected output is:
G01,38020, XX, 3M EUR, Sep-07,10,23, ,
, , XX, 3M EUR, Sep-07,11, ,72,
, , , , , ,23,72,
, , XX, 3M EUR, Dec-07,14, ,500,
, , , , , ,0,500,
Check out the image for how the output should look like: (Output is shown in TSV format just for better clarity.... the processing needs to be done in .CSV format only)
http://img229.imageshack.us/img229/2247/aggok5.jpg
For instance...
The values (G01,38020) are same in the first 2 rows...
Hence these 2 rows are clubbed together in the output.... You can also see the addition of the values in the LAST 2 columns.... FOR those 2 rows.
The third row also has (G01,38020) but has a different value (Dec-07) in the fifth column... Hence its shown separately..
The change in values needs to be seen only in the first 5 columns.
The addition needs to be done only for the last 2 columns.
Can you help me out in this?