Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: swapping PIPE for comma in CSV file

by Anonymous Monk
on Jun 26, 2007 at 15:44 UTC ( #623444=note: print w/replies, xml ) Need Help??


in reply to Re: swapping PIPE for comma in CSV file
in thread swapping PIPE for comma in CSV file

A few people missed this (myself included). You have to split on a pair of double quotes or no quotes at all. There's the field with commas in it which you can't replace with a pipe so a simple regex or split/join won't work (at least without a massive regex on the split).
  • Comment on Re^2: swapping PIPE for comma in CSV file

Replies are listed 'Best First'.
Re^3: swapping PIPE for comma in CSV file
by girarde (Hermit) on Jun 26, 2007 at 16:59 UTC
    Right, but I'm splitting on the 'quote, comma, quote' pattern, so embedded commas sail through. You can split on a pattern, although join wants a string.
      But what about the quote-comma-numbers transition?
        Rats, I missed that. Time for an expression.
        Also time to verbally abuse the people who decided to provide a comma delimited file with commas in the data "occasionally". I usually ask for delimitation with backticks.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://623444]
help
Chatterbox?
[GotToBTru]: but then .. if you have nothing to say, why not say nothing?
[MidLifeXis]: I have a user who has a lot of say on how some of our processes work that abhors significant blanks. Perhaps that is a part of it. A not-so-obvious "this space intentionally left blank" indicator.
[MidLifeXis]: On the back end, however, that doesn't mean that i have to use that value to indicate "undefined", no matter how much he thinks I should.

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2017-01-20 19:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (176 votes). Check out past polls.