From The GNU Awk guide - 7.1.4.2 Input/Output from BEGIN and END Rules
Traditionally, due largely to implementation issues, $0 and NF were
undefined inside an END rule. The POSIX standard specifies that NF is
available in an END rule. It contains the number of fields from the
last input record. Most probably due to an oversight, the standard
does not say that $0 is also preserved, although logically one would
think that it should be. In fact, all of BWK awk, mawk, and gawk
preserve the value of $0 for use in END rules. Be aware, however, that
some other implementations and many older versions of Unix awk do not.
So, in general, END
now contains the last $0
, whereas in your [old] awk version it does not.
For example, my GNU Awk does work in the "new" way:
$ awk --version
GNU Awk 4.1.0, API: 1.0
$ seq 10 | awk 'END {print}'
10
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…