There are two features of historical awk implementations that
gawk supports.
First, it is possible to call the length built-in function not only
with no arguments, but even without parentheses!
a = length
is the same as either of
a = length() a = length($0)
For example:
$ echo abcdef | awk '{ print length }'
-| 6
This feature is marked as "deprecated" in the POSIX standard, and
gawk will issue a warning about its use if `--lint' is
specified on the command line.
(The ability to use length this way was actually an accident of the
original Unix awk implementation. If any built-in function used
$0 as its default argument, it was possible to call that function
without the parentheses. In particular, it was common practice to use
the length function in this fashion, and this usage was documented
in the awk manual page.)
The other historical feature is the use of either the break statement,
or the continue statement
outside the body of a while, for, or do loop. Traditional
awk implementations have treated such usage as equivalent to the
next statement. More recent versions of Unix awk do not allow
it. gawk supports this usage if `--traditional' has been
specified.
See section Command Line Options, for more information about the `--posix' and `--lint' options.
Go to the first, previous, next, last section, table of contents.