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, andTEXTDOMAINvariables (see section Predefined Variables)
- - The
- Special files in I/O redirections:
- - The
/dev/stdin,/dev/stdout,/dev/stderr, and/dev/fd/Nspecial file names (see section Special File names ingawk) - - The
/inet,/inet4, and/inet6special files for TCP/IP networking using ‘|&’ to specify which version of the IP protocol to use (see section Usinggawkfor Network Programming)
- - The
- Changes and/or additions to the language:
- - The ‘
\x’ escape sequence (see section Escape Sequences) - - Full support for both POSIX and GNU regexps (see section Regular Expressions)
- - The ability for
FSand for the third argument tosplit()to be null strings (see section Making Each Character a Separate Field) - - The ability for
RSto be a regexp (see section How Input Is Split into Records) - - The ability to use octal and hexadecimal constants in
awkprogram source code (see section Octal and Hexadecimal Numbers) - - The ‘
|&’ operator for two-way I/O to a coprocess (see section Two-Way Communications with Another Process) - - Indirect function calls (see section Indirect Function Calls)
- - Directories on the command line produce a warning and are skipped (see section Directories on the Command Line)
- - Output with
printandprintfneed not be fatal (see section Enabling Nonfatal Output)
- - The ‘
- New keywords:
- - The
BEGINFILEandENDFILEspecial patterns (see section TheBEGINFILEandENDFILESpecial Patterns) - - The
switchstatement (see section TheswitchStatement)
- - The
- Changes to standard
awkfunctions:- - 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()andsub()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
printfformats for making translations easier (see section RearrangingprintfArguments) - - 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)
- - The optional second argument to
- Additional functions only in
gawk:- - The
gensub(),patsplit(), andstrtonum()functions for more powerful text manipulation (see section String-Manipulation Functions) - - The
asort()andasorti()functions for sorting arrays (see section Controlling Array Traversal and Array Sorting) - - The
mktime(),systime(), andstrftime()functions for working with timestamps (see section Time Functions) - - The
and(),compl(),lshift(),or(),rshift(), andxor()functions for bit manipulation (see section Bit-Manipulation Functions) - - The
isarray()function to check if a variable is an array or not (see section Getting Type Information) - - The
bindtextdomain(),dcgettext(), anddcngettext()functions for internationalization (see section InternationalizingawkPrograms)
- - The
- Changes and/or additions in the command-line options:
- - The
AWKPATHenvironment variable for specifying a path search for the-fcommand-line option (see section Command-Line Options) - - The
AWKLIBPATHenvironment variable for specifying a path search for the-lcommand-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-Vshort 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--versionlong options (see section Command-Line Options).
- - The
- Support for the following obsolete systems was removed from the code and the documentation for
gawkversion 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
gawkversion 4.1:- - Ultrix
- Support for the following systems was removed from the code for
gawkversion 4.2:- - MirBSD
- - GNU/Linux on Alpha
Next: Feature History, Previous: BTL, Up: Language History [Contents][Index]