I'm importing CSV files and some of the fields include quoted text with commas as part of the field, rather than as a field separator. What is the syntax (or alternative method entirely) to import and split the string by comma, while ignoring commas within quotes?
raw = ReadList[file, String];
StringSplit[raw[[#]], ","] &/@Range@Length@raw
This splits each line of the file on commas, but for lines like:
a,b,"c,c",d,e
I get:
a
b
"c
c"
d
e
whereas I would like:
a
b
"c,c"
d
e
(I have represented the elements of the example line as a column to emphasize unique fields)
StringSplit["a,b,\"c,c\",d,e", ","]to try and get it to work – Jason B. Jun 28 '16 at 18:41