bug-gawk
[Top][All Lists]
Advanced

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

Re: Docs: Clarify that accessing field beyond the last one throws lint w


From: david kerns
Subject: Re: Docs: Clarify that accessing field beyond the last one throws lint warning.
Date: Mon, 12 Jun 2023 12:10:39 -0700

On Mon, Jun 12, 2023 at 10:33 AM Sebastian Carlos <sebaaa1754@gmail.com>
wrote:

> > except that $NR is the last (existing) field
>
> ‘NR’ is the number of records read so far. `NF` is the number of fields.
>
> On Mon, Jun 12, 2023 at 7:02 PM david kerns <david.t.kerns@gmail.com>
> wrote:
>
>>
>>
>> On Mon, Jun 12, 2023 at 9:14 AM Sebastian Carlos <sebaaa1754@gmail.com>
>> wrote:
>>
>>> I think this is significant because the next section of the docs even has
>>> an example
>>> that would show that warning if running it with the linter on:
>>>
>>> > awk '{ print $NR }'
>>>
>>> except that $NR is the last (existing) field ... $0 is the whole record
>> (line) and $1 is the first field
>> awk '{print $(NR+1)}'
>> is the first non-existing field ... and hopefully, should not print a
>> warning by default
>>
>
oh right, my bad


reply via email to

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