1

I have a SQL export that is comma delimited, but some of the data has commas in it. Is there any way to fix this? I'm guessing I am going to have to re-export the data with a different delimiter.

3 Answers 3

3

The specification of a CSV is that commas in data be quoted like this a,b,c,"d,e",f. If you can add the qoutes manually then you should be able to get the data to load.

To find lines that need fixing you could grep for lines with more commas than (columns -1).

Note that quoting data without commas is also permissible so if you can rewrite your extract to do this "a","b","c","d,e","f" it will also work (so long as there's no quotes in your data.)

1

If you surround the text fields that contain commas in the data with quotation marks, those commas should not be picked up as delimiters

0

Take a look here, is this what you want?

http://www.talkphp.com/absolute-beginners/5072-importing-comma-delimited-csv-file-containing-commas.html

1
  • You should give a brief explanation about the contents of the link and why it is relevant just in case the link stops working for any reason.
    – MaQleod
    Oct 27, 2010 at 19:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .