in reply to Re: Re: Writing a CSV Parser/Printer
in thread Writing a CSV Parser/Printer
I'm not sure how your desired output should look like. Maybe this will help you. It uses RegEx:perl -pe '$_="$.: $_"' your_input > your_output
Short explanation for the RegEx:use strict; use warnings; while (<DATA>) { my (@fields)= split /, /; foreach (@fields) { if (s/^"((?:[^"\\]|\\.)*)"$/$1/) { #correct tr/\\//d; # No more \ print "$_\n"; } } } __END__ "Perlmonks", "http://www.perlmonks.org", "excellent ;)" "csv", "csv\"xxx", "trall\ala"
/^"((?:[^"\\]|\\.)*)"$/$1/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Writing a CSV Parser/Printer
by Anonymous Monk on Jun 26, 2003 at 07:42 UTC | |
by Skeeve (Parson) on Jun 26, 2003 at 08:07 UTC | |
by Anonymous Monk on Jun 26, 2003 at 22:45 UTC |