Gawk/POSIX 002fGNU

From Get docs

Next: Feature History, Previous: BTL, Up: Language History   [Contents][Index]


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 (see section Command-Line Options).

A number of features have come and gone over the years. This section 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 (see section Predefined Variables)
  • Special files in I/O redirections:
    • - The /dev/stdin, /dev/stdout, /dev/stderr, and /dev/fd/N special file names (see section Special File names in gawk)
    • - The /inet, /inet4, and /inet6 special files for TCP/IP networking using ‘|&’ to specify which version of the IP protocol to use (see section Using gawk for Network Programming)
  • Changes and/or additions to the language:
  • New keywords:
  • Changes to standard awk functions:
    • - The optional second argument to close() that allows closing one end of a two-way pipe to a coprocess (see section Two-Way Communications with Another Process)
    • - POSIX compliance for gsub() and sub() with --posix
    • - The length() function accepts an array argument and returns the number of elements in the array (see section String-Manipulation Functions)
    • - The optional third argument to the match() function for capturing text-matching subexpressions within a regexp (see section String-Manipulation Functions)
    • - Positional specifiers in printf formats for making translations easier (see section Rearranging printf Arguments)
    • - The split() function’s additional optional fourth argument, which is an array to hold the text of the field separators (see section String-Manipulation Functions)
  • Additional functions only in gawk:
  • Changes and/or additions in the command-line options:
    • - The AWKPATH environment variable for specifying a path search for the -f command-line option (see section Command-Line Options)
    • - The AWKLIBPATH environment variable for specifying a path search for the -l command-line option (see section Command-Line 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 (see section Command-Line 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

Next: Feature History, Previous: BTL, Up: Language History   [Contents][Index]