if duplicate value in col1, then append....

December 3, 2010 at 14:12:16
Specs: Windows XP
I'm using Perl.

To begin with, I have 2 columns of data (C1, C2), comma delimited.
ID001, Apple
ID002, Orange
ID003, Peach
ID001, Orange
ID007, Banana
ID002, Tomato
ID009, Peach
ID001, Lemon

What I want to achieve is If any value in C1 = any other value in C1 (eg ID001, ID002) then rearrange so that all the attributes lineup as shown below.

ID001, Apple, Orange, Lemon, NA, NA, NA
ID002, NA, Orange, NA, Tomato, NA, NA
ID003, NA, NA, NA, NA, Peach NA
ID007, NA, NA, NA, NA, NA, Banana
ID009, NA, NA, NA, NA, Peach, NA

I dont really care about the order of rows or columns. Any help would be appreciated.

See More: if duplicate value in col1, then append....

Report •

December 3, 2010 at 19:51:31
Where did the NA come from, SHA NA NA?

Life is too important to be taken seriously.


Report •
Related Solutions

Ask Question