On Tue, 18 Jan 2000, Gate wrote:
> I need to do the following two things (separately):
>
> First.. I have a file with comma delineated fields. The data in each field
> is enclosed in double quotes ("). However, some data fields have a quote
> within the quotes, and I need to remove that. What is my best choice for
> this?
>
You can use Perl as has been suggested, and there is a module that is
supposed to handle CSV files. I handle these files every day, and I found
that the Perl library does not do what I want correctly. My files may come
to me in any format: comma-delimited, comma-and-quote-delimited, or some
combination of the above. I got tired of messing with this and just
created a C++ program to handle this kind of thing. Output is a
tab-delimited list of the fields, whatever they are. However, if there are
embedded quotes inside a field, it does _not_ remove them. Like this:
Joe "The Butcher",Sampson,123 Main St.,Anytown,Anystate,99999
or
"Joe "The Butcher"","Sampson","123 Main St.","Anytown","Anystate","99999"
In both cases, the result will preserve the quotes around "The Butcher".
If you're interested, I can send you a copy of the C++ program (one file,
no makefile, very short).
Paul M. Foster
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.