[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A robust but concise way to read TSV header?
From: |
Alex fxmbsw7 Ratchev |
Subject: |
Re: A robust but concise way to read TSV header? |
Date: |
Thu, 24 Jun 2021 16:46:44 +0200 |
first know exactly what u want, then u can code it, otherwise, its fail at
'many formats'
On Thu, Jun 24, 2021, 16:44 Peng Yu <pengyu.ut@gmail.com> wrote:
> CSV is not an option. I just need to pass TSV files.
>
> BTW, how robust is this csv builtin. CSV is a far more complex format
> than TSV given that CSV involves quoting. It seems that it is not very
> easy to make a CSV builtin correctly given that there are so many
> flavors of CSV formats.
>
> On 6/24/21, Jesse Hathaway <jesse@mbuki-mvuki.org> wrote:
> > On Thu, Jun 24, 2021 at 9:17 AM Peng Yu <pengyu.ut@gmail.com> wrote:
> >> The following won't work, as it removes empty fields.
> >
> > Would using a CSV be an option rather than a TSV? If so you could use the
> > csv builtin:
> >
> > $ enable -f /usr/lib/bash/csv csv
> > $ csv -a foo 'a,,b'
> > $ declare -p foo
> > declare -a foo=([0]="a" [1]="" [2]="b")
> >
>
>
> --
> Regards,
> Peng
>
>