Quote:
Originally Posted by
Scrutinizer
Note: Not all awks retain the values of the field variables in the END section
Is that a current/recent version of nawk?
Not that it changes the fact of the matter, but that behavior has always been a part of POSIX. If I am mistaken and it wasn't specified by the very first version of the standard, it was definitely codified by the second (which is at least 15 years old at this time).
I wonder why any modern, maintained implementation would not be compliant (I do realize that the K in AWK is the person behind nawk and that his work on awk and nawk predates the standard). Since awk generally has no way of indicating when the final record has been reached, aside from the END pattern, it's very useful to keep those variables intact. Also, historical scripts written for such an implementation would either not have been using those variables in END or would have been setting their values, so I don't see any backwards-compatibility issue with becoming compliant.
If that is a current nawk, given the timelines involved, this is on par with having to caution someone about using the $(...) form of command substitution with a recently released version of a POSIX-like shell.
Regards,
Alister