× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I do see a problem with this approach, as well - you would cause an invalid result if you have valid CSV, as Scott presented - """, would become this invalid text. A simple replacement would need to know that there is not another quote before the pair, as above, or after the pair, as in ,""". I think something like sed can do that, from examples shown here and elsewhere - regular expressions, which I know a little better, could look for something like this - ,""([^"]) and replace with ,"\1 or some such construct - that says 'look for a comma, 2 quotes, and anything not a quote, then replace with one quote and the non-quote' - this leaves ,""" alone.

I just had a thought to the OP - are you getting the CSV with some file transfer, such as FTP, so that you have the exact original, or are you getting it already processed? Because, as Scott says, this syntax is highly unusual, and if this is the original, you will need to do some programming or preprocessing, it seems.

Cheers
Vern

On 12/16/2020 2:13 AM, Maria Lucia Stoppa wrote:
I agree with Erik Garske, that's what I would try first.

Il giorno mer 16 dic 2020 alle ore 09:05 Erick Garske <egarske@xxxxxxxxx>
ha scritto:

Could you simply replace every instance of ,"" with ,"' and every instance
of "", with '", ?

On Wed, Dec 16, 2020 at 1:14 AM Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
wrote:

I've never run across a CSV file that used quotes that way in my 30-ish
years of working with CSV. This is very, very unusual. You'll probably
need to customize CSVR4 or write your own routine. That's the fun of
being a programmer, right? When someone sends you something unusual,
you can still make it work.

On 12/15/20 9:31 PM, mlazarus wrote:
I'm trying to process a .csv file using Scott K's CSVR4 program, but
I'm running into an issue where occasionally there's a text field that
contains double quotes in the actual text.

Example:
"1","This is a regular title","AAA"
"2",""This is a quoted title"","BBB"

In the second record the double quote pairs seem to throw the
processor off. Has anyone run into this? Any solution?

-mark
--
Scott Klement
http://www.scottklement.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.