$NF vs NF in the first paragraph
danliston opened this issue · comments
$NF points to last field ### This is not true. It contains the last field "value". NF (without the $ sign) indirectly points to the last field, by holding the total Number of Fields found in $0 (the current record).
NF is built-in variable and can be used in expressions ### to reference the last, or number of, fields in the current record being examined/processed. More simply, NF is the total Number of Fields found in the current record.
$(NF-1) points to second last field and so on ### Again, this would be the "contents" of the second to last field in the current record. NF-1 (without the $ sign) represents the field Number of the second to last field.
well, English isn't my first language, and am not too good in writing prose anyway..
not sure if what I've written is confusing/wrong.. will try to clarify and let you know, thanks
changed the text, I hope it is okay now...
$(2+3)
result of expressions can be used, this one evaluates to$5
and hence gives fifth field- similarly if variable
i
has value2
, then$(i+3)
will give fifth field
- similarly if variable
NF
is a built-in variable which contains number of fields in the current record- so,
$NF
will give last field $(NF-1)
will give second last field and so on
- so,