[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Quotes being stripped by "--csv"
From: |
Ed Morton |
Subject: |
Re: Quotes being stripped by "--csv" |
Date: |
Fri, 24 Nov 2023 03:57:04 -0600 |
I know what the workarounds are, thanks.
Ed Morton
> On Nov 24, 2023, at 3:16 AM, Manuel Collado <mcollado2011@gmail.com> wrote:
>
> El 24/11/23 a las 9:58, arnold@skeeve.com escribió:
>> Manuel Collado <mcollado2011@gmail.com> wrote:
>>>> El 23/11/23 a las 18:35, Ed Morton escribió:
>>>>> ...
>>>>> IMHO we don't need a CSV output mode, we just need a simple way to not
>>>>> strip quotes when splitting input into fields and everything else the
>>>>> user might want to do from there is trivial.
>>>
>>> In that case just use FPAT. No need for -csv or anything else.
>> FPAT doesn't handle embedded newlines.
>
> Yes.
>
>> If that's not a problem,
>> then yes, FPAT will do the trick.
>
> If that is a problem, embedded newlines can be handled with few lines of
> code, like these:
>
> # Collect multi-line records, if it is the case.
> # If necessary, add more input lines to ensure an
> # even number of quotes.
> while (gsub("\"", "\"", $0) % 2 == 1 && (getline more) > 0) {
> $0 = $0 "\n" more
> NR--
> FNR--
> }
>
> Regards.
> --
> Manuel Collado - http://mcollado.z15.es
Re: Quotes being stripped by "--csv", arnold, 2023/11/23