Deutsch   English   Français   Italiano  
<65f296fc$0$713$14726298@news.sunsite.dk>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Newsgroups: comp.lang.awk
Subject: Re: Breaking a table of record rows into an array
References: <urslg4$18isd$1@toylet.eternal-september.org> <usqkgn$he7u$2@dont-email.me> <65f17028$0$707$14726298@news.sunsite.dk> <87y1am5cfo.fsf@nosuchdomain.example.com>
Organization: non
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: arnold@freefriends.org (Aharon Robbins)
Originator: arnold@freefriends.org (Aharon Robbins)
Date: 14 Mar 2024 06:19:40 GMT
Lines: 18
Message-ID: <65f296fc$0$713$14726298@news.sunsite.dk>
NNTP-Posting-Host: 1b35ded3.news.sunsite.dk
X-Trace: 1710397180 news.sunsite.dk 713 arnold@skeeve.com/198.99.81.75:49296
X-Complaints-To: staff@sunsite.dk
Bytes: 1738

In article <87y1am5cfo.fsf@nosuchdomain.example.com>,
Keith Thompson  <Keith.S.Thompson+u@gmail.com> wrote:
>Do you see something in POSIX that defines the behavior of assigning to
>NF?

In the section "Variables and Special Values"

| 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.