On Tuesday, September 2, 2003, at 02:19 PM, JOHN FISHER wrote:
> I have been using the split command happily for awhile, spliting up
> based on commas and tildes.
> However, I had a problem with a new file and noticed my script had
> created extra fields.
> If you have a file like this:
> "Washington, George",909,"Abraham Lincoln",-100.00, "$10,500"
> How can I appropriately split it so I will have 5 fields instead of 7?
> Doesn't appear the split command has this ability. My workaround has
> been to write a script to blank out commas between quotes, but that is
> not a good solution. It forces me to find a way to put the comma back
> after I split it which is efficient.
Text::CSV_XS from the CPAN will do all the work for you. I use it all
the time.