Liste des Groupes | Revenir à cl awk |
In article <87y1am5cfo.fsf@nosuchdomain.example.com>,It doesn't say what happens when you do NF += 2 either. All I'm saying is that changing the value of NF is undefined behavior per POSIX.
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:Do you see something in POSIX that defines the behavior of assigning toIn the section "Variables and Special Values"
NF?
| References to nonexistent fields (that is, fields after $NF), shall
| evaluate to the uninitialized value. Such references shall not create
| new fields. However, assigning to a nonexistent field (for example,
| $(NF+2)=5) shall increase the value of NF; create any intervening fields
| with the uninitialized value; and cause the value of $0 to be
| recomputed, with the fields being separated by the value of OFS. Each
| field variable shall have a string value or an uninitialized value when
| created.
It doesn't say what happens when you do NF -= 2; nonetheless, all
traditional awks throw away fields when you do something like that.
Les messages affichés proviennent d'usenet.