The data set has duplicates records. There can be more than one
duplicate also for the same contact.

How do I remove duplicate records, and build a single record for each
name with maximum possible fields.

Sample input file
FN,    LN,    phone1,      phone2,       email,        city
Matt,  x,     9800000000,            ,              ,  NYC
Matt,   ,     9800000001,  8822334490,              ,
Matt,  x,     9845012345,  9800000000,              ,
Matt,   ,     9800000000,            , xyz / gmail.com,  NYC
Matt,  x,               ,  9845012345, xyz / gmail.com,  NYC
Matt,  x,     9845012345,  9800000000,              ,  NYC
Matt,  y,     9800000001,            ,              ,  NYC

Sample Output
FN,    LN,  phone1,      phone2,    email,         city
Matt,   x,  9800000000, 9845012345, xyz / gmail.com, NYC
Matt,   y,  9800000001, 8822334490,              , NYC

-- 
Posted via http://www.ruby-forum.com/.