Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Semicolon delimited to Comma delimited

by Tux (Canon)
on Apr 23, 2015 at 12:29 UTC ( [id://1124389]=note: print w/replies, xml ) Need Help??


in reply to Semicolon delimited to Comma delimited

Disregarding the Microsoft issues with localized list-separator characters, as described here, and given that you already have exported to CSV, be it with another separator than the required ,, the solution is extremely simple, using Text::CSV_XS:

$ cat bad.csv
a;b;c
1;2;3
;4;
"Føó";"Hēłŀõ Ẇőŕļđ";
$ perl -C3 -MText::CSV_XS=csv -we'csv (in => "bad.csv", sep => ";")'
a,b,c
1,2,3
,4,
Føó,"Hēłŀõ Ẇőŕļđ",

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^2: Semicolon delimited to Comma delimited
by swatzz (Novice) on Apr 23, 2015 at 14:00 UTC

    Sorry forgot to point out or rather make clear that i am extracting data from *.csv and writing to Excel. And there is this one sheet in Excel which completely copy pastes the contents of *.csv file to Excel. I just call it 'raw data'. This part does not work at all with my Indian counterpart because of this weird 'semi-colon - comma' issue :(

      Interesting; I'd missed this when I first read the thread.. I've found CSV to be unreliable as a copy/paste source, and generally use TSV which is astoundingly reliable in Excel.

      Doesn't solve your problem, of course; you still need to know which semicolons to convert to tabs or commas and so this hasn't helped you at all -- just a note from a fairly heavy Excel user, in case it helps you in the future.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2025-12-05 09:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (83 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.