Is awk's nextfile specified in POSIX?

You'll see that bug 607 is targetted for Issue 8, not released yet (see the issue8 Tags).

Issue 7 was released in 2008, there have been a few newer editions of issue 7, latest in 2018, but those are technical corrigenda, they don't bring new features.

nextfile is not only a new feature but also breaks backward compatibility as awk '{nextfile = 1}' and awk '{nextfile}' are valid awk invocations which in the current POSIX version set and retrieve the value of a nextfile variable respectively, so it could possibly not be added as part of a technical corrigendum.

What could be added (and probably should have) in a TC is to tell people that nextfile is a word reserved for future use so that people should not use it in their variable or function names, as a script that does awk '{nextfile = 1}', though perfectly standard, does not work in many awk implementations (that's not limited to nextfile btw).

You can check a HTML rendition of the awk part of the 2018 edition of Issue 7 of the Single UNIX Specification at https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/awk.html (note the .2018edition part), though note that even though it is published by the Opengroup, the HTML version has no value of standard, only the PDF does (you need to register with them to get access to it).

They're meant to be equivalent, though there have been several bugs in the conversion to HTML in the past which have caused sections to be missing (though they're generally fixed quickly when spotted), so when in doubt, best is to check the PDF.


POSIX standardisation can be seen as two distinct efforts:

  • Bug fixing that does not affect interfaces, this is released as so called technical corrigendum. The current Issue 7 standard is basically from 2008 and the 2018 release is TC2.

  • New features that affect interfaces. This requires a new major version of the standard.

The awk issue if marked as Issue 8 for named reasons and we are currently working on finalizing the Issue 8 standard that is expected to be ready in 2021.

Tags:

Awk

Posix