Page 1 of 1

Combine rows on condition

PostPosted: Tue Oct 29, 2013 1:30 pm
by mfnme
Hi,

I have requirement to combine rows from csv file. The records are ,

"JAMES","JOHN","00001","ERROR1","LONDON","UK"
"JAMES","JOHN","00002","ERROR2","LONDON","UK"
"JAMES","JOHN","00003","ERROR3","LONDON","UK"
"ALAN ","MC ","00014","ERROR1","LOSANG","US"
"ALAN ","MC ","00015","ERROR2","LOSANG","US"
"SHAD ","JNR ","00001","ERROR1","XXXXX","CH"
"SHAD "," JNR ","00002","ERROR2","XXXXX","CH"

As there can be maximum of 5 errors per record/person.I would like to have output as

"JAMES","JOHN","00001","ERROR1","00002","ERROR2","00003","ERROR3","","","","","LONDON","UK"
"ALAN ","MC ","00014","ERROR1","00015","ERROR2","","","","","","","LOSANG","US"
"SHAD ","JNR ","00001","ERROR1","00002","ERROR2","","","","","","","XXXXX","CH"

I need to combine the error code ( eg:00001) and error description(eg:ERROR1) for same person in to one record and make sure that the
comma delimiter is there for all 5 error code, error record pairs

Please provide ur valuable help