gawk: POSIX/GNU
A.5 Extensions in 'gawk' Not in POSIX 'awk'
===========================================
The GNU implementation, 'gawk', adds a large number of features. They
can all be disabled with either the '--traditional' or '--posix' options
(Options).
A number of features have come and gone over the years. This minor
node summarizes the additional features over POSIX 'awk' that are in the
current version of 'gawk'.
* Additional predefined variables:
- The 'ARGIND', 'BINMODE', 'ERRNO', 'FIELDWIDTHS', 'FPAT',
'IGNORECASE', 'LINT', 'PROCINFO', 'RT', and 'TEXTDOMAIN'
variables (Built-in Variables)
* Special files in I/O redirections:
- The '/dev/stdin', '/dev/stdout', '/dev/stderr', and
'/dev/fd/N' special file names (Special Files)
- The '/inet', '/inet4', and '/inet6' special files for TCP/IP
networking using '|&' to specify which version of the IP
protocol to use (TCP/IP Networking)
* Changes and/or additions to the language:
- The '\x' escape sequence (Escape Sequences)
- Full support for both POSIX and GNU regexps (Regexp)
- The ability for 'FS' and for the third argument to 'split()'
to be null strings (Single Character Fields)
- The ability for 'RS' to be a regexp (Records)
- The ability to use octal and hexadecimal constants in 'awk'
program source code (Nondecimal-numbers)
Two-way I/O::)
- Indirect function calls (Indirect Calls)
- Directories on the command line produce a warning and are
skipped (Command-line directories)
Nonfatal::)
* New keywords:
BEGINFILE/ENDFILE::)
- The 'switch' statement (Switch Statement)
* Changes to standard 'awk' functions:
- The optional second argument to 'close()' that allows closing
one end of a two-way pipe to a coprocess (Two-way I/O)
- POSIX compliance for 'gsub()' and 'sub()' with '--posix'
- The 'length()' function accepts an array argument and returns
the number of elements in the array (String Functions)
- The optional third argument to the 'match()' function for
String Functions::)
- Positional specifiers in 'printf' formats for making
translations easier (Printf Ordering)
- The 'split()' function's additional optional fourth argument,
which is an array to hold the text of the field separators
(String Functions)
* Additional functions only in 'gawk':
- The 'gensub()', 'patsplit()', and 'strtonum()' functions for
more powerful text manipulation (String Functions)
- The 'asort()' and 'asorti()' functions for sorting arrays
(Array Sorting)
- The 'mktime()', 'systime()', and 'strftime()' functions for
working with timestamps (Time Functions)
- The 'and()', 'compl()', 'lshift()', 'or()', 'rshift()', and
Functions::)
- The 'isarray()' function to check if a variable is an array or
not (Type Functions)
- The 'bindtextdomain()', 'dcgettext()', and 'dcngettext()'
functions for internationalization (Programmer i18n)
* Changes and/or additions in the command-line options:
- The 'AWKPATH' environment variable for specifying a path
search for the '-f' command-line option (Options)
- The 'AWKLIBPATH' environment variable for specifying a path
search for the '-l' command-line option (Options)
- The '-b', '-c', '-C', '-d', '-D', '-e', '-E', '-g', '-h',
'-i', '-l', '-L', '-M', '-n', '-N', '-o', '-O', '-p', '-P',
'-r', '-s', '-S', '-t', and '-V' short options. Also, the
ability to use GNU-style long-named options that start with
'--', and the '--assign', '--bignum', '--characters-as-bytes',
'--copyright', '--debug', '--dump-variables', '--exec',
'--field-separator', '--file', '--gen-pot', '--help',
'--include', '--lint', '--lint-old', '--load',
'--non-decimal-data', '--optimize', '--no-optimize',
'--posix', '--pretty-print', '--profile', '--re-interval',
'--sandbox', '--source', '--traditional', '--use-lc-numeric',
and '--version' long options (Options).
* Support for the following obsolete systems was removed from the
code and the documentation for 'gawk' version 4.0:
- Amiga
- Atari
- BeOS
- Cray
- MIPS RiscOS
- MS-DOS with the Microsoft Compiler
- MS-Windows with the Microsoft Compiler
- NeXT
- SunOS 3.x, Sun 386 (Road Runner)
- Tandem (non-POSIX)
- Prestandard VAX C compiler for VAX/VMS
- GCC for VAX and Alpha has not been tested for a while.
* Support for the following obsolete system was removed from the code
for 'gawk' version 4.1:
- Ultrix
* Support for the following systems was removed from the code for
'gawk' version 4.2:
- MirBSD
- GNU/Linux on Alpha