[Top][All Lists]

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

Re: Numerical field labels and --header-in

From: Erik Auerswald
Subject: Re: Numerical field labels and --header-in
Date: Sat, 21 May 2022 19:04:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1


On 20.05.22 06:13, Tim Rice wrote:
 0    1   2
 1.1 2.2 3.3

Then 'datamash --header-in sum 1' returns 1.1 and NOT 2.2. This sucks.

Oh yeah, good catch.

If header names are available, those thould be the only way to reference

I'm afraid this would break a lot of backwards compatibility.

The info documentation describes this and provides the correct
syntax to reference a number from the header line as field name:

   "Field names must be escaped with a backslash if they start with a
    digit or contain special characters (dash/minus, colons, commas)."

    $ printf '0\t1\t2\n1.1\t2.2\t3.3\n'
    0       1       2
    1.1     2.2     3.3
    $ printf '0\t1\t2\n1.1\t2.2\t3.3\n' \
    > | env LC_NUMERIC=C ./datamash --header-in sum 1
    $ printf '0\t1\t2\n1.1\t2.2\t3.3\n' \
    > | env LC_NUMERIC=C ./datamash --header-in sum \\1

Thus I'd say this behavior should not be changed.


reply via email to

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