Liste des Groupes | Revenir à cl awk |
In article <usqkgn$he7u$2@dont-email.me>,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.
Ed Morton <mortonspam@gmail.com> wrote:the effect of setting `NF` isThis is not true. The effect of setting NF was well defined
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
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.
Les messages affichés proviennent d'usenet.