Sujet : Re: [gawk] Handling variants of CSV input data formats
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.awkDate : 27. Aug 2024, 01:31:18
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vaj6oo$2looc$1@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 26.08.2024 19:01, Manuel Collado wrote:
El 26/8/24 a las 14:54, Janis Papanagnou escribió:
>
My opinion on this is that I wouldn't expect GNU Awk to become a (yet
another) CSV-processor. It's very convenient to have an easy input of
CSV data to be processed like other tabular data with Awk. So removal
of the (outer) quotes, transforming "inner" quotes of fields according
to the CSV-standard(s), and handling the escape symbol, would serve my
expectations. (I don't need CSV-output formatting, but I understand if
there is such a demand.)
Perhaps you could try my gawk-csvio pure gawk library. Just include a
first unconditional rule calling csvimport(...) and the CSV input data
will be automatically converted to a regular OFS-delimited record ready
to be processed.
Please find the library at http://mcollado.z15.es/gawk-extras/. The
documentation is available also to be read before downloading.
As said upthread: "Myself I'm usually not using CSV format(s), [...]".
But thanks, I'll forward that information to interested people I know.
Just to clarify; my above stated opinion was meant to provide a view
concerning the newly incorporated '--csv' feature to obtain a greater
acceptance and not disappointment from people choosing and using GNU
Awk for that purpose. Given how it got implemented it's (IMO) of very
limited use (if you cannot control the delimiters and quotes).
If I understand correctly that the library you mention would address
the two topics (field separator and quoting) then there's even less a
point (I suppose) to use the new '--csv' option in GNU Awk; just use
your library instead?
Janis