View Single Post
Old 08-09-2007   #1 (permalink)
BZP
Guest


 
 

Modify CSV, add fields

Hello,

I start with PS, and ... hum, difficult for me

I have a CSV file, like this :

Field1;Field2;Field3;Field4
John;PATTY;555-12345;NY
Homer;MAC CULLY;555-32147;NH
Selma;BOUVIER;555-12378:KS

And i want to parse and modify it, this is the target :

Field0;Field1;Field2;Field3;Field4;Field5
John PATTY;John;PATTY;555-12345;NY;JP
Homer MAC CULLY;Homer;MAC CULLY;555-32147;NH;HM
Selma BOUVIER;Selma;BOUVIER;555-12378;KS;SB

So, add two fields which are given by other fields in the CSV

Field0 = Field1 + Field2

Field5 = Initials of Field0

Shall i use import csv ? Or can i use a foreach command piped with a
type MyFile.csv ?

Thanks for you help.

--
P.A.

My System SpecsSystem Spec