
mgpg
Novice
Feb 15, 2008, 3:26 PM
Views: 3634
|
I hope somecan help me to convert the following csv to the desired output. Input - Each Row has the following columns - Component, Summary, Data, Priority.
- Each row may span multiple lines, row is delimited by a ^M
- All strings. Priority is P1, P2, etc.
- Data is kind of weird. It is in quotes and has enumerated steps (please see sample below). It may contain commas! But not quotes.
- A comma is a delimted by comma (see exception above for Data)
- I cannot change the csv - generated by some tool.
Sample Input Component1,Summary2 ,"1.Step1 2. Step2 details 3. Step3 details ",P2^M Component2,Summary1,"1. User1 does this 2. User2 does that 3. User1 does something else ",P2^M Component2,Summary2 ,"1.Step1 2. Step2 details 3. Step3 details ",P1^M Desired Output foreach component { print priority foreach step in Data { print <step-number>## step } print summary\n } as well as foreach priority { print component foreach step in Data { print <step-number>## step } print summary\n } I hope someone can help me here. Thanks a bunch :)
(This post was edited by mgpg on Feb 15, 2008, 3:27 PM)
|