bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quotes being stripped by "--csv"


From: Manuel Collado
Subject: Re: Quotes being stripped by "--csv"
Date: Sun, 19 Nov 2023 13:09:26 +0100
User-agent: Mozilla Thunderbird

El 19/11/23 a las 9:37, arnold@skeeve.com escribió:
Hi.

I understand what you're saying. I don't have an answer at this point.
I think it would be helpful for you to open an issue on the Github repo
for Brian Kernighan's awk, as CSV handling was his idea. Maybe he can
come up with something.

In any case, opening an issue there will allow for wider discussion amongst
AWK implementors.

To clarify things, it should be noted that there are two fundamental modes of handling CSV data. Either:

- Focusing on the CSV representation of fields, or
- Focusing on the real value of field data.

In the first mode $0 should be the original CSV record, and $1..$NF should be the fragments of $0 identified by the CSV parser. I.e. with their original quoting.

In the second mode $1..$NF should be the unquoted, real field data values. And $0 should be the concatenation of these fields delimited by OFS. In order to be consistent with the awk concept of records and fields.

These two modes are then incompatible. You must chose to implement one or the other. Of course, it is possible to support both approaches, and use a suitable command line flag or control variable to select the desired one.

And it is also possible to implement only one mode, and provide additional functions to convert between the real data values and their CSV representation.

HTH. Regards.
--
Manuel Collado - http://mcollado.z15.es



reply via email to

[Prev in Thread] Current Thread [Next in Thread]