Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: One Liner to double quote every field in a delimited file

by Tux (Monsignor)
on Feb 01, 2014 at 16:00 UTC ( #1072976=note: print w/ replies, xml ) Need Help??


in reply to Re: One Liner to double quote every field in a delimited file
in thread One Liner to double quote every field in a delimited file

Joe,43,anytown,anystate,zipcode,"71""","4026'47""N 07958'36""W"

or

"Joe","43","anytown","anystate","zipcode","71""","4026'47""N 07958'36""W"

Enjoy, Have FUN! H.Merijn


Comment on Re^2: One Liner to double quote every field in a delimited file
Select or Download Code
Re^3: One Liner to double quote every field in a delimited file
by Skeeve (Vicar) on Feb 01, 2014 at 16:41 UTC

    This should work:

    chomp($_=<DATA>); $_= join(',', map { s/"/""/g; '"' . $_ . '"' } split /,/) . "\n";

    s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
    +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1072976]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2014-09-19 09:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (133 votes), past polls