8/5 help, there are commas INSIDE the fields of my Comma Separated File
E.g. column 136, is "lastname, firstname". Now, being so
damn clever, i figured that hey, i'll just make the field separator
\",\" but that doesn't work 'cause the number fields aren't quotated.
What should i do? -phuqm
\_ ~scotsman/bin/csv.pl
But you could just go through and add quotes around the currently
nonquoted fields. I've seen some stupid csv handling in any number
of products. Basic csv is: 1) comma separated 2) if field contains
a comma, surround with "'s 3) if field surrounded by "'s contains
"'s, escape the "'s as "". Many people can't get this through
their skulls. --scotsman
\_ clever? use tabs as delimiter
\_ I didn't generate the file. -phuqm
\_ self-depricating sarcasm is a sign of maturity. insults are not.
\_ Find which lines have excessive # of commas and massage those data
lines differently? Or if ALL lines are "lastname,firstname"
then just treat it as an additional command-separated field.
Or convert the data so that the where quotes and commas occur,
convert them to 3 commas or some OTHER field-separator like
# or % or something not used anywhere in your datafile
It's very simple, so maybe i do not understand what ur asking.
\_ Oh the sanity and simplicity of it all! Can't you make it more
complex to show your superiority?
\_ this is a standard CSV format. the comma is a delimiter but the
"x,y" is _also_ counted as a single item. oddly enough, CSV files
have 2 delimiters and you need to program for both the simple case
and the "matching double quoted" case.
\- use (f)lex --psb
\_ use perl. type perl csv in google.
\_ sigh... this was covered in one of my cs60c projects. now
they just type keywords into google and copy the results. |