devnul has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I have a CSV file which needs some cleanup in order for Text::CSV_XS to be able to parse it. I know what I need to do, just not sure how to do it.
First a sample:
This breaks up into 3 fields:
I can get the above to work if I change the above to:
This required two changes:
#1. Changing /", "/ to /",/
#2. Double-quoting some wierd title
I can do #1 with a regex with no difficulty, but have no idea how to do #2.
Any ideas?
- dEvNuL
I have a CSV file which needs some cleanup in order for Text::CSV_XS to be able to parse it. I know what I need to do, just not sure how to do it.
First a sample:
"title", "Some Name, "some wierd title"", "555-555-5555"
This breaks up into 3 fields:
#1. title #2. Some Name, "some wierd title" #3. 555-555-5555
I can get the above to work if I change the above to:
"title","Some Name,""some wierd title""","555-555-5555"
This required two changes:
#1. Changing /", "/ to /",/
#2. Double-quoting some wierd title
I can do #1 with a regex with no difficulty, but have no idea how to do #2.
Any ideas?
- dEvNuL
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: CSV cleanup problem...
by kaif (Friar) on Jun 14, 2005 at 01:57 UTC | |
Re: CSV cleanup problem...
by GrandFather (Saint) on Jun 14, 2005 at 02:27 UTC | |
Re: CSV cleanup problem...
by jZed (Prior) on Jun 14, 2005 at 04:48 UTC | |
Re: CSV cleanup problem...
by BrowserUk (Patriarch) on Jun 14, 2005 at 05:40 UTC | |
by jZed (Prior) on Jun 14, 2005 at 05:56 UTC | |
Re: CSV cleanup problem...
by tlm (Prior) on Jun 14, 2005 at 01:51 UTC | |
by jZed (Prior) on Jun 14, 2005 at 02:54 UTC | |
Re: CSV cleanup problem...
by ikegami (Patriarch) on Jun 14, 2005 at 02:14 UTC | |
by kaif (Friar) on Jun 14, 2005 at 02:37 UTC |
Back to
Seekers of Perl Wisdom