[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Quotes being stripped by "--csv"
From: |
arnold |
Subject: |
Re: Quotes being stripped by "--csv" |
Date: |
Thu, 23 Nov 2023 07:56:21 -0700 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
Hi Ed.
Ed Morton <mortoneccc@comcast.net> wrote:
> If there was a way to have `--csv` optionally NOT strip double quotes
> when reading the fields then that'd solve the problem, e.g. `--csv=q` or
> `--csvq` or similar to indicate quotes in and around fields should be
> retained. ....
Thanks for the note and for opening the issue on Github.
I asked Brian Kernighan in private mail about about this.
Here is his response, quoted by permission.
> Date: Wed, 22 Nov 2023 08:01:17 -0500 (EST)
> From: Brian Kernighan <bwk@...>
> Subject: Re: CSV output
>
> Hi --
>
> I'm pretty skeptical about preserving the it-was-quoted status of
> input fields, since it seems likely to add distributed complexity
> and offeres a chance to create more dark corners, for little
> profit.
>
> Does the "quoted" status persist when the value of a field is
> changed? How about when it is copied? When it's used in a string
> concatenation? When $0 is reconstituted from $1 ... $NF? While
> one could legitimately argue either way on such things, each would
> require more code and explanation.
>
> It's reminiscent of other intricate states, starting with string
> vs number vs both, then OFMT vs CONVFMT, and of course the
> internal states that try to cope with memory management.
>
> On the flip side, this rule is easy to state and explain:
>
> quotes are removed on input
> quotes can be added when needed with a 2-line function
>
> Color me opposed, I think.
>
> Brian
I have to say I agree with him. I note that the gawk manual
has functions similar to those in the second edition of the awk
book, and they're included in the gawk distribution.
Thanks,
Arnold
- Re: Quotes being stripped by "--csv", (continued)
- Re: Quotes being stripped by "--csv", Ben Hoyt, 2023/11/19
- Re: Quotes being stripped by "--csv", Ed Morton, 2023/11/23
- Re: Quotes being stripped by "--csv", Manuel Collado, 2023/11/24
- Re: Quotes being stripped by "--csv", arnold, 2023/11/24
- Re: Quotes being stripped by "--csv", Manuel Collado, 2023/11/24
- Re: Quotes being stripped by "--csv", Ed Morton, 2023/11/24
- Re: Quotes being stripped by "--csv", Ed Morton, 2023/11/24
- Re: Quotes being stripped by "--csv", Ben Hoyt, 2023/11/25
- Re: Quotes being stripped by "--csv", Ed Morton, 2023/11/26
- Re: Quotes being stripped by "--csv", Neil R. Ormos, 2023/11/26
Re: Quotes being stripped by "--csv",
arnold <=
Re: Quotes being stripped by "--csv", J Naman, 2023/11/27