Home Explore Blog CI



man-pages

16th chunk of `awk.man`
3617fd563cf4529e7c4fc71eb15423b36480407adfd0ef430000000100000d49
 intersection is empty, the empty string is returned; so sub‐
              str("ABC", 1, 0) = "" and substr("ABC", -4, 6) = "A".

          •   Every string, including the empty string, matches the empty string at the front so, s ~ // and s ~ "", are always 1 as is match(s, //) and match(s, "").  The last two set RLENGTH to 0.

          •   index(s,  t)  is always the same as match(s, t1) where t1 is the same as t with metacharacters escaped.  Hence consistency with match requires that index(s, "") always returns 1.  Also the condition, index(s,t)
              != 0 if and only t is a substring of s, requires index("","") = 1.

          •   If getline encounters end of file, getline var, leaves var unchanged.  Similarly, on entry to the END actions, $0, the fields and NF have their value unaltered from the last record.

ENVIRONMENT VARIABLES
       Mawk recognizes these variables:

          MAWKBINMODE
             (see COMPATIBILITY ISSUES)

          MAWK_LONG_OPTIONS
             If this is set, mawk uses its value to decide what to do with GNU‐style long options:

               allow  Mawk allows the option to be checked against the (small) set of long options it recognizes.

                      The long names from the -W option are recognized, e.g., --version is derived from -Wversion.

               error  Mawk prints an error message and exits.  This is the default.

               ignore Mawk ignores the option, unless it happens to be one of the one it recognizes.

               warn   Print an warning message and otherwise ignore the option.

             If the variable is unset, mawk prints an error message and exits.

          WHINY_USERS
             This is a gawk 3.1.0 feature, removed in the 4.0.0 release.  It tells mawk to sort array indices before it starts to iterate over the elements of an array.

SEE ALSO
       grep(1)

       Aho, Kernighan and Weinberger, The AWK Programming Language, Addison‐Wesley Publishing, 1988, (the AWK book), defines the language, opening with a tutorial and advancing to many interesting programs  that  delve  into
       issues of software design and analysis relevant to programming in any language.

       The  GAWK  Manual, The Free Software Foundation, 1991, is a tutorial and language reference that does not attempt the depth of the AWK book and assumes the reader may be a novice programmer.  The section on AWK arrays
       is excellent.  It also discusses POSIX requirements for AWK.

       mawk‐arrays(7) discusses mawk’s implementation of arrays.

       mawk‐code(7) gives more information on the -W dump option.

BUGS
       mawk implements printf() and sprintf() using the C library functions, printf and sprintf, so full ANSI compatibility requires an ANSI C library.  In practice this means the h conversion qualifier may not be available.

       Also mawk inherits any bugs or limitations of the library functions.

       Implementors of the AWK language have shown a consistent lack of imagination when naming their programs.

AUTHOR
       Mike Brennan (brennan@whidbey.com).
       Thomas E. Dickey <dickey@invisible‐island.net>.

Version 1.3.4                                                                                              2023‐04‐04                                                                                                    MAWK(1)

Title: Environment Variables, Related Resources, and Known Bugs in MAWK
Summary
This section details the environment variables recognized by MAWK, namely MAWKBINMODE and MAWK_LONG_OPTIONS, the latter allowing customization of GNU-style long option handling (allow, error, ignore, warn), and WHINY_USERS which relates to array sorting behavior (a gawk 3.1.0 feature). It then lists related resources like grep(1), the AWK book, the GAWK manual, mawk-arrays(7), and mawk-code(7). Finally, it outlines known bugs, particularly limitations with printf() and sprintf() due to reliance on the C library, and acknowledges the author(s) of MAWK.