Re: Breaking a table of record rows into an array

Liste des GroupesRevenir à cl awk 
Sujet : Re: Breaking a table of record rows into an array
De : mortonspam (at) *nospam* gmail.com (Ed Morton)
Groupes : comp.lang.awk
Date : 14. Mar 2024, 00:27:30
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <ustcp3$1734f$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
On 3/13/2024 4:21 AM, Aharon Robbins wrote:
In article <usqkgn$he7u$2@dont-email.me>,
Ed Morton  <mortonspam@gmail.com> wrote:
the effect of setting `NF` is
undefined behavior per POSIX and so will do different things in
different awk variants and even in 1 awk variant can behave differently
depending on whether you're setting it to a higher or lower than
original value
 This is not true. The effect of setting NF was well defined
by the original awk book and also in POSIX.
 Decreasing NF throws away fields. Increasing NF adds the
intervening fields with the null string as their values
and rebuilds the record.
Arnold - I don't know about the original awk book but POSIX (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html) only defines what happens if you populate $X, not what happens if you populate NF. If you set $X awk rebuilds the record and if X is some value higher than the current value of NF then awk adds the intervening fields with the null string as their values, but POSIX doesn't specify what happens if you set NF to any value.
If I'm wrong about that I'd love for you or anyone else to point me to the section that defines it as I've scoured the standard several times looking for it over the years.
     Ed.

Date Sujet#  Auteur
11 Mar 24 * Re: Breaking a table of record rows into an array19Mr. Man-wai Chang
11 Mar 24 +- Re: Breaking a table of record rows into an array1Keith Thompson
12 Mar 24 +- Re: Breaking a table of record rows into an array1Janis Papanagnou
13 Mar 24 `* Re: Breaking a table of record rows into an array16Ed Morton
13 Mar 24  `* Re: Breaking a table of record rows into an array15Aharon Robbins
13 Mar 24   +* Re: Breaking a table of record rows into an array13Keith Thompson
13 Mar 24   i+* Re: Breaking a table of record rows into an array7Kaz Kylheku
13 Mar 24   ii`* Re: Breaking a table of record rows into an array6Keith Thompson
13 Mar 24   ii +* Re: Breaking a table of record rows into an array4Kaz Kylheku
14 Mar 24   ii i+* Re: Breaking a table of record rows into an array2Ed Morton
14 Mar 24   ii ii`- Re: Breaking a table of record rows into an array1Kaz Kylheku
14 Mar 24   ii i`- Re: Breaking a table of record rows into an array1Keith Thompson
14 Mar 24   ii `- Re: Breaking a table of record rows into an array1Kaz Kylheku
14 Mar 24   i`* Re: Breaking a table of record rows into an array5Aharon Robbins
14 Mar 24   i +- Re: Breaking a table of record rows into an array1Keith Thompson
14 Mar 24   i `* Re: Breaking a table of record rows into an array3Ed Morton
14 Mar 24   i  `* Re: Breaking a table of record rows into an array2Ed Morton
14 Mar 24   i   `- Re: Breaking a table of record rows into an array1Ed Morton
14 Mar 24   `- Re: Breaking a table of record rows into an array1Ed Morton

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal