diff options
-rw-r--r-- | doc/ChangeLog | 4 | ||||
-rw-r--r-- | doc/gawk.info | 1394 | ||||
-rw-r--r-- | doc/gawk.texi | 195 | ||||
-rw-r--r-- | doc/gawktexi.in | 195 |
4 files changed, 915 insertions, 873 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index 40ac2eb4..4ae87a19 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2014-08-20 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: Continuing on reviewer comments. + 2014-08-16 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Continuing on reviewer comments. diff --git a/doc/gawk.info b/doc/gawk.info index 501b8136..7c97a5c9 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -769,12 +769,10 @@ Preface Several kinds of tasks occur repeatedly when working with text files. You might want to extract certain lines and discard the rest. Or you -may need to make changes wherever certain patterns appear, but leave -the rest of the file alone. Writing single-use programs for these -tasks in languages such as C, C++, or Java is time-consuming and -inconvenient. Such jobs are often easier with `awk'. The `awk' -utility interprets a special-purpose programming language that makes it -easy to handle simple data-reformatting jobs. +may need to make changes wherever certain patterns appear, but leave the +rest of the file alone. Such jobs are often easy with `awk'. The +`awk' utility interprets a special-purpose programming language that +makes it easy to handle simple data-reformatting jobs. The GNU implementation of `awk' is called `gawk'; if you invoke it with the proper options or environment variables (*note Options::), it @@ -818,12 +816,11 @@ such as input/output (I/O) redirection and pipes. different computing environments. This Info file, while describing the `awk' language in general, also describes the particular implementation of `awk' called `gawk' (which stands for "GNU `awk'"). `gawk' runs on -a broad range of Unix systems, ranging from Intel(R)-architecture -PC-based computers up through large-scale systems. `gawk' has also -been ported to Mac OS X, Microsoft Windows (all versions) and OS/2 PCs, -and OpenVMS. (Some other, obsolete systems to which `gawk' was once -ported are no longer supported and the code for those systems has been -removed.) +a broad range of Unix systems, ranging from Intel-architecture PC-based +computers up through large-scale systems. `gawk' has also been ported +to Mac OS X, Microsoft Windows (all versions) and OS/2 PCs, and OpenVMS. +(Some other, obsolete systems to which `gawk' was once ported are no +longer supported and the code for those systems has been removed.) * Menu: @@ -840,7 +837,7 @@ removed.) ---------- Footnotes ---------- - (1) The 2008 POSIX standard is accessable online at + (1) The 2008 POSIX standard is accessible online at `http://www.opengroup.org/onlinepubs/9699919799/'. (2) These commands are available on POSIX-compliant systems, as well @@ -1155,7 +1152,7 @@ released but remains in an early stage of development. Until the GNU operating system is more fully developed, you should consider using GNU/Linux, a freely distributable, Unix-like operating -system for Intel(R), Power Architecture, Sun SPARC, IBM S/390, and other +system for Intel, Power Architecture, Sun SPARC, IBM S/390, and other systems.(2) Many GNU/Linux distributions are available for download from the Internet. @@ -2249,14 +2246,13 @@ those that it has are much larger than they used to be. If you find yourself writing `awk' scripts of more than, say, a few hundred lines, you might consider using a different programming language. The shell is good at string and pattern matching; in -addition, it allows powerful use of the system utilities. More -conventional languages, such as C, C++, and Java, offer better -facilities for system programming and for managing the complexity of -large programs. Python offers a nice balance between high-level ease -of programming and access to system facilities. Programs in these -languages may require more lines of source code than the equivalent -`awk' programs, but they are easier to maintain and usually run more -efficiently. +addition, it allows powerful use of the system utilities. Python +offers a nice balance between high-level ease of programming and access +to system facilities.(1) + + ---------- Footnotes ---------- + + (1) Other popular scripting languages include Ruby and Perl. File: gawk.info, Node: Intro Summary, Prev: When, Up: Getting Started @@ -2475,9 +2471,9 @@ The following list describes options mandated by the POSIX standard: This option is particularly necessary for World Wide Web CGI applications that pass arguments through the URL; using this option prevents a malicious (or other) user from passing in - options, assignments, or `awk' source code (via `--source') to the - CGI application. This option should be used with `#!' scripts - (*note Executable Scripts::), like so: + options, assignments, or `awk' source code (via `-e') to the CGI + application. This option should be used with `#!' scripts (*note + Executable Scripts::), like so: #! /usr/local/bin/gawk -E @@ -2667,16 +2663,14 @@ standard input but then you will not be able to also use the standard input as a source of data.) Because it is clumsy using the standard `awk' mechanisms to mix -source file and command-line `awk' programs, `gawk' provides the -`--source' option. This does not require you to pre-empt the standard -input for your source code; it allows you to easily mix command-line -and library source code (*note AWKPATH Variable::). As with `-f', the -`--source' and `--include' options may also be used multiple times on -the command line. +source file and command-line `awk' programs, `gawk' provides the `-e' +option. This does not require you to pre-empt the standard input for +your source code; it allows you to easily mix command-line and library +source code (*note AWKPATH Variable::). As with `-f', the `-e' and `-i' +options may also be used multiple times on the command line. - If no `-f' or `--source' option is specified, then `gawk' uses the -first non-option command-line argument as the text of the program -source code. + If no `-f' or `-e' option is specified, then `gawk' uses the first +non-option command-line argument as the text of the program source code. If the environment variable `POSIXLY_CORRECT' exists, then `gawk' behaves in strict POSIX mode, exactly as if you had supplied `--posix'. @@ -2831,7 +2825,7 @@ in a standard directory in the default path and then specified on the command line with a short file name. Otherwise, the full file name would have to be typed for each file. - By using the `-i' option, or the `--source' and `-f' options, your + By using the `-i' option, or the `-e' and `-f' options, your command-line `awk' programs can use facilities in `awk' library files (*note Library Functions::). Path searching is not done if `gawk' is in compatibility mode. This is true for both `--traditional' and @@ -3355,6 +3349,10 @@ apply to both string constants and regexp constants: more than two hexadecimal digits produces undefined results. (The `\x' escape sequence is not allowed in POSIX `awk'.) + CAUTION: The next major relase of `gawk' will change, such + that a maximum of two hexadecimal digits following the `\x' + will be used. + `\/' A literal slash (necessary for regexp constants only). This sequence is used when you want to write a regexp constant that @@ -9618,29 +9616,36 @@ match to a given case is made, the case statement bodies execute until a `break', `continue', `next', `nextfile' or `exit' is encountered, or the end of the `switch' statement itself. For example: - switch (NR * 2 + 1) { - case 3: - case "11": - print NR - 1 - break - - case /2[[:digit:]]+/: - print NR - - default: - print NR + 1 - - case -1: - print NR * -1 + while ((c = getopt(ARGC, ARGV, "aksx")) != -1) { + switch (c) { + case "a": + # report size of all files + all_files = TRUE; + break + case "k": + BLOCK_SIZE = 1024 # 1K block size + break + case "s": + # do sums only + sum_only = TRUE + break + case "x": + # don't cross filesystems + fts_flags = or(fts_flags, FTS_XDEV) + break + case "?": + default: + usage() + break + } } Note that if none of the statements specified above halt execution of a matched `case' statement, execution falls through to the next -`case' until execution halts. In the above example, for any case value -starting with `2' followed by one or more digits, the `print' statement -is executed and then falls through into the `default' section, -executing its `print' statement. In turn, the -1 case will also be -executed since the `default' does not halt execution. +`case' until execution halts. In the above example, the `case' for +`"?"' falls through to the `default' case, which is to call a function +named `usage()'. (The `getopt()' function being called here is +described in *note Getopt Function::.) File: gawk.info, Node: Break Statement, Next: Continue Statement, Prev: Switch Statement, Up: Statements @@ -9741,7 +9746,8 @@ the previous example with the following `while' loop: print "" } -This program loops forever once `x' reaches 5. +This program loops forever once `x' reaches 5, since the increment +(`x++') is never reached. The `continue' statement has no special meaning with respect to the `switch' statement, nor does it have any meaning when used outside the @@ -10497,8 +10503,16 @@ elements from `ARGV' (*note Delete::). All of these actions are typically done in the `BEGIN' rule, before actual processing of the input begins. *Note Split Program::, and see *note Tee Program::, for examples of each way of removing elements from -`ARGV'. The following fragment processes `ARGV' in order to examine, -and then remove, command-line options: +`ARGV'. + + To actually get options into an `awk' program, end the `awk' options +with `--' and then supply the `awk' program's options, in the following +manner: + + awk -f myprog.awk -- -v -q file1 file2 ... + + The following fragment processes `ARGV' in order to examine, and +then remove, the above command-line options: BEGIN { for (i = 1; i < ARGC; i++) { @@ -10516,19 +10530,14 @@ and then remove, command-line options: } } - To actually get the options into the `awk' program, end the `awk' -options with `--' and then supply the `awk' program's options, in the -following manner: - - awk -f myprog -- -v -q file1 file2 ... - - This is not necessary in `gawk'. Unless `--posix' has been -specified, `gawk' silently puts any unrecognized options into `ARGV' -for the `awk' program to deal with. As soon as it sees an unknown -option, `gawk' stops looking for other options that it might otherwise -recognize. The previous example with `gawk' would be: + Ending the `awk' options with `--' isn't necessary in `gawk'. Unless +`--posix' has been specified, `gawk' silently puts any unrecognized +options into `ARGV' for the `awk' program to deal with. As soon as it +sees an unknown option, `gawk' stops looking for other options that it +might otherwise recognize. The previous command line with `gawk' would +be: - gawk -f myprog -q -v file1 file2 ... + gawk -f myprog.awk -q -v file1 file2 ... Because `-q' is not a valid `gawk' option, it and the following `-v' are passed on to the `awk' program. (*Note Getopt Function::, for an @@ -10775,8 +10784,9 @@ been assigned any value as well as elements that have been deleted # Check if "foo" exists in a: Incorrect! if (a["foo"] != "") ... - This is incorrect, since this will _create_ `a["foo"]' if it - didn't exist before! + This is incorrect for two reasons. First, it _creates_ `a["foo"]' + if it didn't exist before! Second, it is valid (if a bit unusual) + to set an array element equal to the empty string. To determine whether an element exists in an array at a certain index, use the following expression: @@ -11329,10 +11339,11 @@ multidimensional array, use the same operator (`in') that is used for single dimensional arrays. Write the whole sequence of indices in parentheses, separated by commas, as the left operand: - (SUBSCRIPT1, SUBSCRIPT2, ...) in ARRAY + if ((SUBSCRIPT1, SUBSCRIPT2, ...) in ARRAY) + ... - The following example treats its input as a two-dimensional array of -fields; it rotates this array 90 degrees clockwise and prints the + Here is an example that treats its input as a two-dimensional array +of fields; it rotates this array 90 degrees clockwise and prints the result. It assumes that all lines have the same number of elements: { @@ -11771,6 +11782,9 @@ brackets ([ ]): easy to keep track of the seeds in case you need to consistently reproduce sequences of random numbers. + POSIX does not specify the initial seed; it differs among `awk' + implementations. + ---------- Footnotes ---------- (1) The C version of `rand()' on many Unix systems is known to @@ -13352,7 +13366,8 @@ this program, using our function to format the results, prints: 5.6 21.2 - This function deletes all the elements in an array: + This function deletes all the elements in an array (recall that the +extra whitespace signifies the start of the local variable list): function delarray(a, i) { @@ -13386,7 +13401,7 @@ empty. way: $ echo "Don't Panic!" | - > gawk --source '{ print rev($0) }' -f rev.awk + > gawk -e '{ print rev($0) }' -f rev.awk -| !cinaP t'noD The C `ctime()' function takes a timestamp and returns it in a @@ -14150,7 +14165,7 @@ P.J. Plauger wrote: In fact, they felt this idea was so important that they placed this statement on the cover of their book. Because we believe strongly that their statement is correct, this major node and *note Sample -Programs::, provide a good-sized body of code for you to read, and we +Programs::, provide a good-sized body of code for you to read and, we hope, to learn from. This major node presents a library of useful `awk' functions. Many @@ -18187,8 +18202,8 @@ language.(1) It works as follows: 2. For any arguments that do represent `awk' text, put the arguments into a shell variable that will be expanded. There are two cases: - a. Literal text, provided with `--source' or `--source='. This - text is just appended directly. + a. Literal text, provided with `-e' or `--source'. This text is + just appended directly. b. Source file names, provided with `-f'. We use a neat trick and append `@include FILENAME' to the shell variable's @@ -21329,8 +21344,8 @@ File: gawk.info, Node: Debugging Summary, Prev: Limitations, Up: Debugger * Debuggers let you step through your program one statement at a time, examine and change variable and array values, and do a - number of other things that let understand what your program is - actually doing (as opposed to what it is supposed to do). + number of other things that let you understand what your program + is actually doing (as opposed to what it is supposed to do). * Like most debuggers, the `gawk' debugger works in terms of stack frames, and lets you set both breakpoints (stop at a point in the @@ -21597,10 +21612,9 @@ Auto-set::). The MPFR library provides precise control over precisions and rounding modes, and gives correctly rounded, reproducible, -platform-independent results. With either of the command-line options -`--bignum' or `-M', all floating-point arithmetic operators and numeric -functions can yield results to any desired precision level supported by -MPFR. +platform-independent results. With the `-M' command-line option, all +floating-point arithmetic operators and numeric functions can yield +results to any desired precision level supported by MPFR. Two built-in variables, `PREC' and `ROUNDMODE', provide control over the working precision and the rounding mode. The precision and the @@ -21613,7 +21627,7 @@ File: gawk.info, Node: FP Math Caution, Next: Arbitrary Precision Integers, P 15.4 Floating Point Arithmetic: Caveat Emptor! ============================================== - Math class is tough! -- Teen Talk Barbie (July, 1992) + Math class is tough! -- Teen Talk Barbie, July 1992 This minor node provides a high level overview of the issues involved when doing lots of floating-point arithmetic.(1) The @@ -22007,13 +22021,13 @@ File: gawk.info, Node: Arbitrary Precision Integers, Next: POSIX Floating Poin 15.5 Arbitrary Precision Integer Arithmetic with `gawk' ======================================================= -When given one of the options `--bignum' or `-M', `gawk' performs all -integer arithmetic using GMP arbitrary precision integers. Any number -that looks like an integer in a source or data file is stored as an -arbitrary precision integer. The size of the integer is limited only -by the available memory. For example, the following computes 5^4^3^2, -the result of which is beyond the limits of ordinary hardware -double-precision floating point values: +When given the `-M' option, `gawk' performs all integer arithmetic +using GMP arbitrary precision integers. Any number that looks like an +integer in a source or data file is stored as an arbitrary precision +integer. The size of the integer is limited only by the available +memory. For example, the following computes 5^4^3^2, the result of +which is beyond the limits of ordinary hardware double-precision +floating point values: $ gawk -M 'BEGIN { > x = 5^4^3^2 @@ -22193,13 +22207,13 @@ File: gawk.info, Node: Floating point summary, Prev: POSIX Floating Point Prob * Often, increasing the accuracy and then rounding to the desired number of digits produces reasonable results. - * Use either `-M' or `--bignum' to enable MPFR arithmetic. Use - `PREC' to set the precision in bits, and `ROUNDMODE' to set the - IEEE 754 rounding mode. + * Use `-M' (or `--bignum') to enable MPFR arithmetic. Use `PREC' to + set the precision in bits, and `ROUNDMODE' to set the IEEE 754 + rounding mode. - * With `-M' or `--bignum', `gawk' performs arbitrary precision - integer arithmetic using the GMP library. This is faster and more - space efficient than using MPFR for the same calculations. + * With `-M', `gawk' performs arbitrary precision integer arithmetic + using the GMP library. This is faster and more space efficient + than using MPFR for the same calculations. * There are several "dark corners" with respect to floating-point numbers where `gawk' disagrees with the POSIX standard. It pays @@ -22519,7 +22533,7 @@ operations: place `-Dinline=''' on your command line, or use the GNU Autotools and include a `config.h' file in your extensions. - * All pointers filled in by `gawk' are to memory managed by `gawk' + * All pointers filled in by `gawk' point to memory managed by `gawk' and should be treated by the extension as read-only. Memory for _all_ strings passed into `gawk' from the extension _must_ come from calling the API-provided function pointers `api_malloc()', @@ -22929,7 +22943,7 @@ File: gawk.info, Node: Exit Callback Functions, Next: Extension Version String An "exit callback" function is a function that `gawk' calls before it exits. Such functions are useful if you have general "cleanup" tasks -that should be performed in your extension (such as closing data base +that should be performed in your extension (such as closing database connections or other resource deallocations). You can register such a function with `gawk' using the following function. @@ -26056,7 +26070,7 @@ the current version of `gawk'. `-r', `-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', `--execle', + `--copyright', `--debug', `--dump-variables', `--exec', `--field-separator', `--file', `--gen-pot', `--help', `--include', `--lint', `--lint-old', `--load', `--non-decimal-data', `--optimize', `--posix', @@ -27502,7 +27516,7 @@ These give the same result as the `-W BINMODE=2' option in `mawk'. The following changes the record separator to `"\r\n"' and sets binary mode on reads, but does not affect the mode on standard input: - gawk -v RS="\r\n" --source "BEGIN { BINMODE = 1 }" ... + gawk -v RS="\r\n" -e "BEGIN { BINMODE = 1 }" ... or: @@ -28841,7 +28855,7 @@ C.7 Summary `--parsedebug' option is available if `gawk' is compiled with `-DDEBUG'. - * The source code for `gawk' is maintained in a publicly accessable + * The source code for `gawk' is maintained in a publicly accessible Git repository. Anyone may check it out and view the source. * Contributions to `gawk' are welcome. Following the steps outlined @@ -31010,6 +31024,7 @@ Index * -c option: Options. (line 81) * -D option: Options. (line 108) * -d option: Options. (line 93) +* -e option: Options. (line 335) * -E option: Options. (line 125) * -e option: Options. (line 117) * -f option: Options. (line 25) @@ -31093,10 +31108,10 @@ Index * [] (square brackets), regexp operator: Regexp Operators. (line 56) * \ (backslash): Comments. (line 50) * \ (backslash) in shell commands: Read Terminal. (line 25) -* \ (backslash), \" escape sequence: Escape Sequences. (line 76) +* \ (backslash), \" escape sequence: Escape Sequences. (line 80) * \ (backslash), \' operator (gawk): GNU Regexp Operators. (line 56) -* \ (backslash), \/ escape sequence: Escape Sequences. (line 69) +* \ (backslash), \/ escape sequence: Escape Sequences. (line 73) * \ (backslash), \< operator (gawk): GNU Regexp Operators. (line 30) * \ (backslash), \> operator (gawk): GNU Regexp Operators. @@ -31137,7 +31152,7 @@ Index * \ (backslash), in bracket expressions: Bracket Expressions. (line 17) * \ (backslash), in escape sequences: Escape Sequences. (line 6) * \ (backslash), in escape sequences, POSIX and: Escape Sequences. - (line 112) + (line 116) * \ (backslash), in regexp constants: Computed Regexps. (line 29) * \ (backslash), in shell commands: Quoting. (line 48) * \ (backslash), regexp operator: Regexp Operators. (line 18) @@ -31330,7 +31345,7 @@ Index (line 6) * awk, function of: Getting Started. (line 6) * awk, gawk and <1>: This Manual. (line 14) -* awk, gawk and: Preface. (line 23) +* awk, gawk and: Preface. (line 21) * awk, history of: History. (line 17) * awk, implementation issues, pipes: Redirection. (line 135) * awk, implementations: Other Versions. (line 6) @@ -31338,15 +31353,15 @@ Index * awk, invoking: Command Line. (line 6) * awk, new vs. old: Names. (line 6) * awk, new vs. old, OFMT variable: Strings And Numbers. (line 57) -* awk, POSIX and: Preface. (line 23) -* awk, POSIX and, See Also POSIX awk: Preface. (line 23) +* awk, POSIX and: Preface. (line 21) +* awk, POSIX and, See Also POSIX awk: Preface. (line 21) * awk, regexp constants and: Comparison Operators. (line 102) -* awk, See Also gawk: Preface. (line 36) +* awk, See Also gawk: Preface. (line 34) * awk, terms describing: This Manual. (line 6) * awk, uses for <1>: When. (line 6) * awk, uses for <2>: Getting Started. (line 12) -* awk, uses for: Preface. (line 23) +* awk, uses for: Preface. (line 21) * awk, versions of <1>: V7/SVR3.1. (line 6) * awk, versions of: Names. (line 10) * awk, versions of, changes between SVR3.1 and SVR4: SVR4. (line 6) @@ -31366,10 +31381,10 @@ Index * b debugger command (alias for break): Breakpoint Control. (line 11) * backslash (\): Comments. (line 50) * backslash (\) in shell commands: Read Terminal. (line 25) -* backslash (\), \" escape sequence: Escape Sequences. (line 76) +* backslash (\), \" escape sequence: Escape Sequences. (line 80) * backslash (\), \' operator (gawk): GNU Regexp Operators. (line 56) -* backslash (\), \/ escape sequence: Escape Sequences. (line 69) +* backslash (\), \/ escape sequence: Escape Sequences. (line 73) * backslash (\), \< operator (gawk): GNU Regexp Operators. (line 30) * backslash (\), \> operator (gawk): GNU Regexp Operators. @@ -31410,7 +31425,7 @@ Index * backslash (\), in bracket expressions: Bracket Expressions. (line 17) * backslash (\), in escape sequences: Escape Sequences. (line 6) * backslash (\), in escape sequences, POSIX and: Escape Sequences. - (line 112) + (line 116) * backslash (\), in regexp constants: Computed Regexps. (line 29) * backslash (\), in shell commands: Quoting. (line 48) * backslash (\), regexp operator: Regexp Operators. (line 18) @@ -31505,7 +31520,7 @@ Index * Brian Kernighan's awk <3>: String Functions. (line 490) * Brian Kernighan's awk <4>: Delete. (line 48) * Brian Kernighan's awk <5>: Nextfile Statement. (line 47) -* Brian Kernighan's awk <6>: Continue Statement. (line 43) +* Brian Kernighan's awk <6>: Continue Statement. (line 44) * Brian Kernighan's awk <7>: Break Statement. (line 51) * Brian Kernighan's awk <8>: I/O And BEGIN/END. (line 16) * Brian Kernighan's awk <9>: Concatenation. (line 36) @@ -31514,9 +31529,9 @@ Index (line 67) * Brian Kernighan's awk <12>: GNU Regexp Operators. (line 83) -* Brian Kernighan's awk <13>: Escape Sequences. (line 116) +* Brian Kernighan's awk <13>: Escape Sequences. (line 120) * Brian Kernighan's awk <14>: When. (line 21) -* Brian Kernighan's awk: Preface. (line 15) +* Brian Kernighan's awk: Preface. (line 13) * Brian Kernighan's awk, extensions: BTL. (line 6) * Brian Kernighan's awk, source code: Other Versions. (line 13) * Brini, Davide: Signature Program. (line 6) @@ -31712,9 +31727,9 @@ Index * cosine: Numeric Functions. (line 15) * counting: Wc Program. (line 6) * csh utility: Statements/Lines. (line 44) -* csh utility, POSIXLY_CORRECT environment variable: Options. (line 355) +* csh utility, POSIXLY_CORRECT environment variable: Options. (line 353) * csh utility, |& operator, comparison with: Two-way I/O. (line 25) -* ctime() user-defined function: Function Example. (line 73) +* ctime() user-defined function: Function Example. (line 74) * currency symbols, localization: Explaining gettext. (line 104) * current system time: Time Functions. (line 66) * custom.h file: Configuration Philosophy. @@ -31739,11 +31754,11 @@ Index * dark corner, close() function: Close Files And Pipes. (line 131) * dark corner, command-line arguments: Assignment Options. (line 43) -* dark corner, continue statement: Continue Statement. (line 43) +* dark corner, continue statement: Continue Statement. (line 44) * dark corner, CONVFMT variable: Strings And Numbers. (line 40) * dark corner, escape sequences: Other Arguments. (line 31) * dark corner, escape sequences, for metacharacters: Escape Sequences. - (line 134) + (line 138) * dark corner, exit statement: Exit Statement. (line 30) * dark corner, field separators: Field Splitting Summary. (line 46) @@ -31914,7 +31929,7 @@ Index * describe call stack frame, in debugger: Debugger Info. (line 27) * differences between gawk and awk: String Functions. (line 197) * differences in awk and gawk, ARGC/ARGV variables: ARGC and ARGV. - (line 88) + (line 90) * differences in awk and gawk, ARGIND variable: Auto-set. (line 44) * differences in awk and gawk, array elements, deleting: Delete. (line 39) @@ -32389,7 +32404,7 @@ Index * gawk version: Auto-set. (line 199) * gawk, ARGIND variable in: Other Arguments. (line 12) * gawk, awk and <1>: This Manual. (line 14) -* gawk, awk and: Preface. (line 23) +* gawk, awk and: Preface. (line 21) * gawk, bitwise operations in: Bitwise Functions. (line 39) * gawk, break statement in: Break Statement. (line 51) * gawk, built-in variables and: Built-in Variables. (line 14) @@ -32403,7 +32418,7 @@ Index (line 6) * gawk, configuring, options: Additional Configuration Options. (line 6) -* gawk, continue statement in: Continue Statement. (line 43) +* gawk, continue statement in: Continue Statement. (line 44) * gawk, distribution: Distribution contents. (line 6) * gawk, ERRNO variable in <1>: TCP/IP Networking. (line 54) @@ -32412,7 +32427,7 @@ Index * gawk, ERRNO variable in <4>: Close Files And Pipes. (line 139) * gawk, ERRNO variable in: Getline. (line 19) -* gawk, escape sequences: Escape Sequences. (line 124) +* gawk, escape sequences: Escape Sequences. (line 128) * gawk, extensions, disabling: Options. (line 254) * gawk, features, adding: Adding Code. (line 6) * gawk, features, advanced: Advanced Features. (line 6) @@ -32466,14 +32481,14 @@ Index * gawk, RT variable in <1>: Auto-set. (line 257) * gawk, RT variable in <2>: Multiple Line. (line 129) * gawk, RT variable in: awk split records. (line 124) -* gawk, See Also awk: Preface. (line 36) +* gawk, See Also awk: Preface. (line 34) * gawk, source code, obtaining: Getting. (line 6) * gawk, splitting fields and: Constant Size. (line 88) * gawk, string-translation functions: I18N Functions. (line 6) * gawk, SYMTAB array in: Auto-set. (line 261) * gawk, TEXTDOMAIN variable in: User-modified. (line 152) * gawk, timestamps: Time Functions. (line 6) -* gawk, uses for: Preface. (line 36) +* gawk, uses for: Preface. (line 34) * gawk, versions of, information about, printing: Options. (line 300) * gawk, VMS version of: VMS Installation. (line 6) * gawk, word-boundary operator: GNU Regexp Operators. @@ -32535,7 +32550,7 @@ Index * git utility: gawkextlib. (line 29) * Git, use of for gawk source code: Derived Files. (line 6) * GNITS mailing list: Acknowledgments. (line 52) -* GNU awk, See gawk: Preface. (line 53) +* GNU awk, See gawk: Preface. (line 51) * GNU Free Documentation License: GNU Free Documentation License. (line 7) * GNU General Public License: Glossary. (line 305) @@ -32617,7 +32632,7 @@ Index (line 43) * in operator, order of array access: Scanning an Array. (line 48) * in operator, testing if array element exists: Reference to Elements. - (line 37) + (line 38) * in operator, use in loops: Scanning an Array. (line 17) * increment operators: Increment Ops. (line 6) * index: String Functions. (line 155) @@ -32785,7 +32800,7 @@ Index * lint checking, empty programs: Command Line. (line 16) * lint checking, issuing warnings: Options. (line 185) * lint checking, POSIXLY_CORRECT environment variable: Options. - (line 340) + (line 338) * lint checking, undefined functions: Pass By Value/Reference. (line 88) * LINT variable: User-modified. (line 88) @@ -32846,7 +32861,7 @@ Index * mawk utility <2>: Nextfile Statement. (line 47) * mawk utility <3>: Concatenation. (line 36) * mawk utility <4>: Getline/Pipe. (line 62) -* mawk utility: Escape Sequences. (line 124) +* mawk utility: Escape Sequences. (line 128) * maximum precision supported by MPFR library: Auto-set. (line 213) * McIlroy, Doug: Glossary. (line 149) * McPhee, Patrick: Contributors. (line 100) @@ -32859,7 +32874,7 @@ Index (line 54) * messages from extensions: Printing Messages. (line 6) * metacharacters in regular expressions: Regexp Operators. (line 6) -* metacharacters, escape sequences for: Escape Sequences. (line 130) +* metacharacters, escape sequences for: Escape Sequences. (line 134) * minimum precision supported by MPFR library: Auto-set. (line 216) * mktime: Time Functions. (line 25) * modifiers, in format specifiers: Format Modifiers. (line 6) @@ -33080,14 +33095,14 @@ Index * plus sign (+), += operator: Assignment Ops. (line 82) * plus sign (+), regexp operator: Regexp Operators. (line 103) * pointers to functions: Indirect Calls. (line 6) -* portability: Escape Sequences. (line 94) +* portability: Escape Sequences. (line 98) * portability, #! (executable scripts): Executable Scripts. (line 33) * portability, ** operator and: Arithmetic Ops. (line 81) * portability, **= operator and: Assignment Ops. (line 143) * portability, ARGV variable: Executable Scripts. (line 42) * portability, backslash continuation and: Statements/Lines. (line 30) * portability, backslash in escape sequences: Escape Sequences. - (line 112) + (line 116) * portability, close() function and: Close Files And Pipes. (line 81) * portability, data files as single record: gawk split records. @@ -33105,7 +33120,7 @@ Index * portability, NF variable, decrementing: Changing Fields. (line 115) * portability, operators: Increment Ops. (line 60) * portability, operators, not in POSIX awk: Precedence. (line 98) -* portability, POSIXLY_CORRECT environment variable: Options. (line 360) +* portability, POSIXLY_CORRECT environment variable: Options. (line 358) * portability, substr() function: String Functions. (line 510) * portable object files <1>: Translator i18n. (line 6) * portable object files: Explaining gettext. (line 37) @@ -33126,14 +33141,14 @@ Index * POSIX awk, < operator and: Getline/File. (line 26) * POSIX awk, arithmetic operators and: Arithmetic Ops. (line 30) * POSIX awk, backslashes in string constants: Escape Sequences. - (line 112) + (line 116) * POSIX awk, BEGIN/END patterns: I/O And BEGIN/END. (line 16) * POSIX awk, bracket expressions and: Bracket Expressions. (line 24) * POSIX awk, bracket expressions and, character classes: Bracket Expressions. (line 30) * POSIX awk, break statement and: Break Statement. (line 51) * POSIX awk, changes in awk versions: POSIX. (line 6) -* POSIX awk, continue statement and: Continue Statement. (line 43) +* POSIX awk, continue statement and: Continue Statement. (line 44) * POSIX awk, CONVFMT variable and: User-modified. (line 30) * POSIX awk, date utility and: Time Functions. (line 254) * POSIX awk, field separators and <1>: Field Splitting Summary. @@ -33155,10 +33170,10 @@ Index * POSIX awk, timestamps and: Time Functions. (line 6) * POSIX awk, | I/O operator and: Getline/Pipe. (line 55) * POSIX mode: Options. (line 254) -* POSIX, awk and: Preface. (line 23) +* POSIX, awk and: Preface. (line 21) * POSIX, gawk extensions not included in: POSIX/GNU. (line 6) * POSIX, programs, implementing in awk: Clones. (line 6) -* POSIXLY_CORRECT environment variable: Options. (line 340) +* POSIXLY_CORRECT environment variable: Options. (line 338) * PREC variable: User-modified. (line 124) * precedence <1>: Precedence. (line 6) * precedence: Increment Ops. (line 60) @@ -33359,7 +33374,7 @@ Index * return statement, user-defined functions: Return Statement. (line 6) * return value, close() function: Close Files And Pipes. (line 131) -* rev() user-defined function: Function Example. (line 53) +* rev() user-defined function: Function Example. (line 54) * revoutput extension: Extension Sample Revout. (line 11) * revtwoway extension: Extension Sample Rev2way. @@ -33494,7 +33509,7 @@ Index * side effects <1>: Increment Ops. (line 11) * side effects: Concatenation. (line 41) * side effects, array indexing: Reference to Elements. - (line 42) + (line 43) * side effects, asort() function: Array Sorting Functions. (line 24) * side effects, assignment expressions: Assignment Ops. (line 23) @@ -33507,14 +33522,14 @@ Index * sidebar, A Constant's Base Does Not Affect Its Value: Nondecimal-numbers. (line 64) * sidebar, Backslash Before Regular Characters: Escape Sequences. - (line 110) + (line 114) * sidebar, Changing FS Does Not Affect the Fields: Field Splitting Summary. (line 38) * sidebar, Changing NR and FNR: Auto-set. (line 299) * sidebar, Controlling Output Buffering with system(): I/O Functions. (line 138) * sidebar, Escape Sequences for Metacharacters: Escape Sequences. - (line 128) + (line 132) * sidebar, FS and IGNORECASE: Field Splitting Summary. (line 64) * sidebar, Interactive Versus Noninteractive Buffering: I/O Functions. @@ -33742,7 +33757,7 @@ Index (line 37) * troubleshooting, awk uses FS not IFS: Field Separators. (line 30) * troubleshooting, backslash before nonspecial character: Escape Sequences. - (line 112) + (line 116) * troubleshooting, division: Arithmetic Ops. (line 44) * troubleshooting, fatal errors, field widths, specifying: Constant Size. (line 23) @@ -33798,7 +33813,7 @@ Index * uniq.awk program: Uniq Program. (line 65) * Unix: Glossary. (line 611) * Unix awk, backslashes in escape sequences: Escape Sequences. - (line 124) + (line 128) * Unix awk, close() function and: Close Files And Pipes. (line 131) * Unix awk, password files, field separators and: Command Line Field Separator. @@ -33945,548 +33960,549 @@ Tag Table: Node: Top1204 Node: Foreword41858 Node: Preface46203 -Ref: Preface-Footnote-149350 -Ref: Preface-Footnote-249457 -Node: History49689 -Node: Names52063 -Ref: Names-Footnote-153527 -Node: This Manual53600 -Ref: This Manual-Footnote-159379 -Node: Conventions59479 -Node: Manual History61635 -Ref: Manual History-Footnote-164714 -Ref: Manual History-Footnote-264755 -Node: How To Contribute64829 -Node: Acknowledgments66068 -Node: Getting Started70816 -Node: Running gawk73250 -Node: One-shot74440 -Node: Read Terminal75665 -Ref: Read Terminal-Footnote-177628 -Node: Long77799 -Node: Executable Scripts79175 -Ref: Executable Scripts-Footnote-181008 -Ref: Executable Scripts-Footnote-281110 -Node: Comments81657 -Node: Quoting84130 -Node: DOS Quoting89443 -Node: Sample Data Files90118 -Node: Very Simple92672 -Node: Two Rules97445 -Node: More Complex99339 -Ref: More Complex-Footnote-1102271 -Node: Statements/Lines102356 -Ref: Statements/Lines-Footnote-1106812 -Node: Other Features107077 -Node: When108005 -Node: Intro Summary110175 -Node: Invoking Gawk110941 -Node: Command Line112456 -Node: Options113247 -Ref: Options-Footnote-1129076 -Node: Other Arguments129101 -Node: Naming Standard Input131763 -Node: Environment Variables132856 -Node: AWKPATH Variable133414 -Ref: AWKPATH Variable-Footnote-1136286 -Ref: AWKPATH Variable-Footnote-2136331 -Node: AWKLIBPATH Variable136591 -Node: Other Environment Variables137350 -Node: Exit Status141007 -Node: Include Files141682 -Node: Loading Shared Libraries145260 -Node: Obsolete146644 -Node: Undocumented147341 -Node: Invoking Summary147608 -Node: Regexp149208 -Node: Regexp Usage150658 -Node: Escape Sequences152691 -Node: Regexp Operators158358 -Ref: Regexp Operators-Footnote-1165838 -Ref: Regexp Operators-Footnote-2165985 -Node: Bracket Expressions166083 -Ref: table-char-classes167973 -Node: GNU Regexp Operators170913 -Node: Case-sensitivity174636 -Ref: Case-sensitivity-Footnote-1177528 -Ref: Case-sensitivity-Footnote-2177763 -Node: Leftmost Longest177871 -Node: Computed Regexps179072 -Node: Regexp Summary182444 -Node: Reading Files183913 -Node: Records186005 -Node: awk split records186748 -Node: gawk split records191606 -Ref: gawk split records-Footnote-1196127 -Node: Fields196164 -Ref: Fields-Footnote-1199128 -Node: Nonconstant Fields199214 -Ref: Nonconstant Fields-Footnote-1201444 -Node: Changing Fields201646 -Node: Field Separators207600 -Node: Default Field Splitting210302 -Node: Regexp Field Splitting211419 -Node: Single Character Fields214760 -Node: Command Line Field Separator215819 -Node: Full Line Fields219245 -Ref: Full Line Fields-Footnote-1219753 -Node: Field Splitting Summary219799 -Ref: Field Splitting Summary-Footnote-1222931 -Node: Constant Size223032 -Node: Splitting By Content227638 -Ref: Splitting By Content-Footnote-1231711 -Node: Multiple Line231751 -Ref: Multiple Line-Footnote-1237607 -Node: Getline237786 -Node: Plain Getline240002 -Node: Getline/Variable242097 -Node: Getline/File243244 -Node: Getline/Variable/File244628 -Ref: Getline/Variable/File-Footnote-1246227 -Node: Getline/Pipe246314 -Node: Getline/Variable/Pipe249013 -Node: Getline/Coprocess250120 -Node: Getline/Variable/Coprocess251372 -Node: Getline Notes252109 -Node: Getline Summary254913 -Ref: table-getline-variants255321 -Node: Read Timeout256233 -Ref: Read Timeout-Footnote-1260060 -Node: Command-line directories260118 -Node: Input Summary261022 -Node: Input Exercises264159 -Node: Printing264892 -Node: Print266614 -Node: Print Examples267955 -Node: Output Separators270734 -Node: OFMT272750 -Node: Printf274108 -Node: Basic Printf275014 -Node: Control Letters276553 -Node: Format Modifiers280544 -Node: Printf Examples286571 -Node: Redirection289035 -Node: Special Files296007 -Node: Special FD296540 -Ref: Special FD-Footnote-1300137 -Node: Special Network300211 -Node: Special Caveats301061 -Node: Close Files And Pipes301857 -Ref: Close Files And Pipes-Footnote-1309018 -Ref: Close Files And Pipes-Footnote-2309166 -Node: Output Summary309316 -Node: Output exercises310313 -Node: Expressions310993 -Node: Values312178 -Node: Constants312854 -Node: Scalar Constants313534 -Ref: Scalar Constants-Footnote-1314393 -Node: Nondecimal-numbers314643 -Node: Regexp Constants317643 -Node: Using Constant Regexps318118 -Node: Variables321190 -Node: Using Variables321845 -Node: Assignment Options323569 -Node: Conversion325444 -Node: Strings And Numbers325968 -Ref: Strings And Numbers-Footnote-1329030 -Node: Locale influences conversions329139 -Ref: table-locale-affects331856 -Node: All Operators332444 -Node: Arithmetic Ops333074 -Node: Concatenation335579 -Ref: Concatenation-Footnote-1338398 -Node: Assignment Ops338518 -Ref: table-assign-ops343501 -Node: Increment Ops344818 -Node: Truth Values and Conditions348256 -Node: Truth Values349339 -Node: Typing and Comparison350388 -Node: Variable Typing351181 -Node: Comparison Operators354833 -Ref: table-relational-ops355243 -Node: POSIX String Comparison358793 -Ref: POSIX String Comparison-Footnote-1359877 -Node: Boolean Ops360015 -Ref: Boolean Ops-Footnote-1364085 -Node: Conditional Exp364176 -Node: Function Calls365903 -Node: Precedence369783 -Node: Locales373452 -Node: Expressions Summary375083 -Node: Patterns and Actions377624 -Node: Pattern Overview378740 -Node: Regexp Patterns380417 -Node: Expression Patterns380960 -Node: Ranges384741 -Node: BEGIN/END387847 -Node: Using BEGIN/END388609 -Ref: Using BEGIN/END-Footnote-1391345 -Node: I/O And BEGIN/END391451 -Node: BEGINFILE/ENDFILE393736 -Node: Empty396667 -Node: Using Shell Variables396984 -Node: Action Overview399267 -Node: Statements401594 -Node: If Statement403442 -Node: While Statement404940 -Node: Do Statement406984 -Node: For Statement408140 -Node: Switch Statement411292 -Node: Break Statement413395 -Node: Continue Statement415450 -Node: Next Statement417243 -Node: Nextfile Statement419633 -Node: Exit Statement422288 -Node: Built-in Variables424692 -Node: User-modified425819 -Ref: User-modified-Footnote-1433508 -Node: Auto-set433570 -Ref: Auto-set-Footnote-1446152 -Ref: Auto-set-Footnote-2446357 -Node: ARGC and ARGV446413 -Node: Pattern Action Summary450267 -Node: Arrays452490 -Node: Array Basics454039 -Node: Array Intro454865 -Ref: figure-array-elements456838 -Node: Reference to Elements459245 -Node: Assigning Elements461518 -Node: Array Example462009 -Node: Scanning an Array463741 -Node: Controlling Scanning466756 -Ref: Controlling Scanning-Footnote-1471929 -Node: Delete472245 -Ref: Delete-Footnote-1475010 -Node: Numeric Array Subscripts475067 -Node: Uninitialized Subscripts477250 -Node: Multidimensional478875 -Node: Multiscanning481968 -Node: Arrays of Arrays483557 -Node: Arrays Summary488220 -Node: Functions490325 -Node: Built-in491198 -Node: Calling Built-in492276 -Node: Numeric Functions494264 -Ref: Numeric Functions-Footnote-1498206 -Ref: Numeric Functions-Footnote-2498563 -Ref: Numeric Functions-Footnote-3498611 -Node: String Functions498880 -Ref: String Functions-Footnote-1521891 -Ref: String Functions-Footnote-2522020 -Ref: String Functions-Footnote-3522268 -Node: Gory Details522355 -Ref: table-sub-escapes524142 -Ref: table-sub-proposed525662 -Ref: table-posix-sub527026 -Ref: table-gensub-escapes528566 -Ref: Gory Details-Footnote-1529742 -Node: I/O Functions529893 -Ref: I/O Functions-Footnote-1537016 -Node: Time Functions537163 -Ref: Time Functions-Footnote-1547627 -Ref: Time Functions-Footnote-2547695 -Ref: Time Functions-Footnote-3547853 -Ref: Time Functions-Footnote-4547964 -Ref: Time Functions-Footnote-5548076 -Ref: Time Functions-Footnote-6548303 -Node: Bitwise Functions548569 -Ref: table-bitwise-ops549131 -Ref: Bitwise Functions-Footnote-1553376 -Node: Type Functions553560 -Node: I18N Functions554702 -Node: User-defined556347 -Node: Definition Syntax557151 -Ref: Definition Syntax-Footnote-1562330 -Node: Function Example562399 -Ref: Function Example-Footnote-1564963 -Node: Function Caveats564985 -Node: Calling A Function565503 -Node: Variable Scope566458 -Node: Pass By Value/Reference569446 -Node: Return Statement572956 -Node: Dynamic Typing575940 -Node: Indirect Calls576869 -Node: Functions Summary586582 -Node: Library Functions589121 -Ref: Library Functions-Footnote-1592739 -Ref: Library Functions-Footnote-2592882 -Node: Library Names593053 -Ref: Library Names-Footnote-1596526 -Ref: Library Names-Footnote-2596746 -Node: General Functions596832 -Node: Strtonum Function597860 -Node: Assert Function600640 -Node: Round Function603966 -Node: Cliff Random Function605507 -Node: Ordinal Functions606523 -Ref: Ordinal Functions-Footnote-1609600 -Ref: Ordinal Functions-Footnote-2609852 -Node: Join Function610063 -Ref: Join Function-Footnote-1611834 -Node: Getlocaltime Function612034 -Node: Readfile Function615770 -Node: Data File Management617609 -Node: Filetrans Function618241 -Node: Rewind Function622310 -Node: File Checking623868 -Ref: File Checking-Footnote-1625000 -Node: Empty Files625201 -Node: Ignoring Assigns627180 -Node: Getopt Function628734 -Ref: Getopt Function-Footnote-1640037 -Node: Passwd Functions640240 -Ref: Passwd Functions-Footnote-1649219 -Node: Group Functions649307 -Ref: Group Functions-Footnote-1657248 -Node: Walking Arrays657461 -Node: Library Functions Summary659064 -Node: Library exercises660452 -Node: Sample Programs661732 -Node: Running Examples662502 -Node: Clones663230 -Node: Cut Program664454 -Node: Egrep Program674322 -Ref: Egrep Program-Footnote-1682293 -Node: Id Program682403 -Node: Split Program686067 -Ref: Split Program-Footnote-1689605 -Node: Tee Program689733 -Node: Uniq Program692540 -Node: Wc Program699970 -Ref: Wc Program-Footnote-1704235 -Node: Miscellaneous Programs704327 -Node: Dupword Program705540 -Node: Alarm Program707571 -Node: Translate Program712385 -Ref: Translate Program-Footnote-1716776 -Ref: Translate Program-Footnote-2717046 -Node: Labels Program717180 -Ref: Labels Program-Footnote-1720551 -Node: Word Sorting720635 -Node: History Sorting724678 -Node: Extract Program726514 -Node: Simple Sed734050 -Node: Igawk Program737112 -Ref: Igawk Program-Footnote-1751423 -Ref: Igawk Program-Footnote-2751624 -Node: Anagram Program751762 -Node: Signature Program754830 -Node: Programs Summary756077 -Node: Programs Exercises757292 -Node: Advanced Features760943 -Node: Nondecimal Data762891 -Node: Array Sorting764468 -Node: Controlling Array Traversal765165 -Node: Array Sorting Functions773445 -Ref: Array Sorting Functions-Footnote-1777352 -Node: Two-way I/O777546 -Ref: Two-way I/O-Footnote-1782490 -Ref: Two-way I/O-Footnote-2782669 -Node: TCP/IP Networking782751 -Node: Profiling785596 -Node: Advanced Features Summary793138 -Node: Internationalization795002 -Node: I18N and L10N796482 -Node: Explaining gettext797168 -Ref: Explaining gettext-Footnote-1802308 -Ref: Explaining gettext-Footnote-2802492 -Node: Programmer i18n802657 -Node: Translator i18n806882 -Node: String Extraction807676 -Ref: String Extraction-Footnote-1808637 -Node: Printf Ordering808723 -Ref: Printf Ordering-Footnote-1811505 -Node: I18N Portability811569 -Ref: I18N Portability-Footnote-1814018 -Node: I18N Example814081 -Ref: I18N Example-Footnote-1816803 -Node: Gawk I18N816875 -Node: I18N Summary817513 -Node: Debugger818852 -Node: Debugging819874 -Node: Debugging Concepts820315 -Node: Debugging Terms822171 -Node: Awk Debugging824768 -Node: Sample Debugging Session825660 -Node: Debugger Invocation826180 -Node: Finding The Bug827513 -Node: List of Debugger Commands833995 -Node: Breakpoint Control835327 -Node: Debugger Execution Control838991 -Node: Viewing And Changing Data842351 -Node: Execution Stack845709 -Node: Debugger Info847222 -Node: Miscellaneous Debugger Commands851216 -Node: Readline Support856400 -Node: Limitations857292 -Node: Debugging Summary859566 -Node: Arbitrary Precision Arithmetic860730 -Node: Computer Arithmetic862217 -Ref: Computer Arithmetic-Footnote-1866604 -Node: Math Definitions866661 -Ref: table-ieee-formats869950 -Ref: Math Definitions-Footnote-1870490 -Node: MPFR features870593 -Node: FP Math Caution872235 -Ref: FP Math Caution-Footnote-1873287 -Node: Inexactness of computations873656 -Node: Inexact representation874604 -Node: Comparing FP Values875959 -Node: Errors accumulate876923 -Node: Getting Accuracy878356 -Node: Try To Round881015 -Node: Setting precision881914 -Ref: table-predefined-precision-strings882596 -Node: Setting the rounding mode884389 -Ref: table-gawk-rounding-modes884753 -Ref: Setting the rounding mode-Footnote-1888207 -Node: Arbitrary Precision Integers888386 -Ref: Arbitrary Precision Integers-Footnote-1891389 -Node: POSIX Floating Point Problems891538 -Ref: POSIX Floating Point Problems-Footnote-1895414 -Node: Floating point summary895452 -Node: Dynamic Extensions897675 -Node: Extension Intro899227 -Node: Plugin License900492 -Node: Extension Mechanism Outline901177 -Ref: figure-load-extension901601 -Ref: figure-load-new-function903086 -Ref: figure-call-new-function904088 -Node: Extension API Description906072 -Node: Extension API Functions Introduction907522 -Node: General Data Types912387 -Ref: General Data Types-Footnote-1918080 -Node: Requesting Values918379 -Ref: table-value-types-returned919116 -Node: Memory Allocation Functions920074 -Ref: Memory Allocation Functions-Footnote-1922821 -Node: Constructor Functions922917 -Node: Registration Functions924675 -Node: Extension Functions925360 -Node: Exit Callback Functions927662 -Node: Extension Version String928911 -Node: Input Parsers929561 -Node: Output Wrappers939375 -Node: Two-way processors943891 -Node: Printing Messages946095 -Ref: Printing Messages-Footnote-1947172 -Node: Updating `ERRNO'947324 -Node: Accessing Parameters948063 -Node: Symbol Table Access949293 -Node: Symbol table by name949807 -Node: Symbol table by cookie951783 -Ref: Symbol table by cookie-Footnote-1955916 -Node: Cached values955979 -Ref: Cached values-Footnote-1959483 -Node: Array Manipulation959574 -Ref: Array Manipulation-Footnote-1960672 -Node: Array Data Types960711 -Ref: Array Data Types-Footnote-1963414 -Node: Array Functions963506 -Node: Flattening Arrays967380 -Node: Creating Arrays974232 -Node: Extension API Variables978963 -Node: Extension Versioning979599 -Node: Extension API Informational Variables981500 -Node: Extension API Boilerplate982586 -Node: Finding Extensions986390 -Node: Extension Example986950 -Node: Internal File Description987680 -Node: Internal File Ops991771 -Ref: Internal File Ops-Footnote-11003203 -Node: Using Internal File Ops1003343 -Ref: Using Internal File Ops-Footnote-11005690 -Node: Extension Samples1005958 -Node: Extension Sample File Functions1007482 -Node: Extension Sample Fnmatch1015050 -Node: Extension Sample Fork1016532 -Node: Extension Sample Inplace1017745 -Node: Extension Sample Ord1019420 -Node: Extension Sample Readdir1020256 -Ref: table-readdir-file-types1021112 -Node: Extension Sample Revout1021911 -Node: Extension Sample Rev2way1022502 -Node: Extension Sample Read write array1023243 -Node: Extension Sample Readfile1025122 -Node: Extension Sample API Tests1026222 -Node: Extension Sample Time1026747 -Node: gawkextlib1028062 -Node: Extension summary1030875 -Node: Extension Exercises1034568 -Node: Language History1035290 -Node: V7/SVR3.11036933 -Node: SVR41039253 -Node: POSIX1040695 -Node: BTL1042081 -Node: POSIX/GNU1042815 -Node: Feature History1048558 -Node: Common Extensions1061688 -Node: Ranges and Locales1063000 -Ref: Ranges and Locales-Footnote-11067617 -Ref: Ranges and Locales-Footnote-21067644 -Ref: Ranges and Locales-Footnote-31067878 -Node: Contributors1068099 -Node: History summary1073524 -Node: Installation1074893 -Node: Gawk Distribution1075844 -Node: Getting1076328 -Node: Extracting1077152 -Node: Distribution contents1078794 -Node: Unix Installation1084511 -Node: Quick Installation1085128 -Node: Additional Configuration Options1087570 -Node: Configuration Philosophy1089308 -Node: Non-Unix Installation1091659 -Node: PC Installation1092117 -Node: PC Binary Installation1093428 -Node: PC Compiling1095276 -Ref: PC Compiling-Footnote-11098275 -Node: PC Testing1098380 -Node: PC Using1099556 -Node: Cygwin1103714 -Node: MSYS1104523 -Node: VMS Installation1105037 -Node: VMS Compilation1105833 -Ref: VMS Compilation-Footnote-11107055 -Node: VMS Dynamic Extensions1107113 -Node: VMS Installation Details1108486 -Node: VMS Running1110738 -Node: VMS GNV1113572 -Node: VMS Old Gawk1114295 -Node: Bugs1114765 -Node: Other Versions1118769 -Node: Installation summary1125024 -Node: Notes1126080 -Node: Compatibility Mode1126945 -Node: Additions1127727 -Node: Accessing The Source1128652 -Node: Adding Code1130088 -Node: New Ports1136266 -Node: Derived Files1140747 -Ref: Derived Files-Footnote-11145828 -Ref: Derived Files-Footnote-21145862 -Ref: Derived Files-Footnote-31146458 -Node: Future Extensions1146572 -Node: Implementation Limitations1147178 -Node: Extension Design1148426 -Node: Old Extension Problems1149580 -Ref: Old Extension Problems-Footnote-11151097 -Node: Extension New Mechanism Goals1151154 -Ref: Extension New Mechanism Goals-Footnote-11154514 -Node: Extension Other Design Decisions1154703 -Node: Extension Future Growth1156809 -Node: Old Extension Mechanism1157645 -Node: Notes summary1159407 -Node: Basic Concepts1160593 -Node: Basic High Level1161274 -Ref: figure-general-flow1161546 -Ref: figure-process-flow1162145 -Ref: Basic High Level-Footnote-11165374 -Node: Basic Data Typing1165559 -Node: Glossary1168887 -Node: Copying1194039 -Node: GNU Free Documentation License1231595 -Node: Index1256731 +Ref: Preface-Footnote-149226 +Ref: Preface-Footnote-249333 +Node: History49565 +Node: Names51939 +Ref: Names-Footnote-153403 +Node: This Manual53476 +Ref: This Manual-Footnote-159255 +Node: Conventions59355 +Node: Manual History61511 +Ref: Manual History-Footnote-164587 +Ref: Manual History-Footnote-264628 +Node: How To Contribute64702 +Node: Acknowledgments65941 +Node: Getting Started70689 +Node: Running gawk73123 +Node: One-shot74313 +Node: Read Terminal75538 +Ref: Read Terminal-Footnote-177501 +Node: Long77672 +Node: Executable Scripts79048 +Ref: Executable Scripts-Footnote-180881 +Ref: Executable Scripts-Footnote-280983 +Node: Comments81530 +Node: Quoting84003 +Node: DOS Quoting89316 +Node: Sample Data Files89991 +Node: Very Simple92545 +Node: Two Rules97318 +Node: More Complex99212 +Ref: More Complex-Footnote-1102144 +Node: Statements/Lines102229 +Ref: Statements/Lines-Footnote-1106685 +Node: Other Features106950 +Node: When107878 +Ref: When-Footnote-1109764 +Node: Intro Summary109829 +Node: Invoking Gawk110595 +Node: Command Line112110 +Node: Options112901 +Ref: Options-Footnote-1128699 +Node: Other Arguments128724 +Node: Naming Standard Input131386 +Node: Environment Variables132479 +Node: AWKPATH Variable133037 +Ref: AWKPATH Variable-Footnote-1135903 +Ref: AWKPATH Variable-Footnote-2135948 +Node: AWKLIBPATH Variable136208 +Node: Other Environment Variables136967 +Node: Exit Status140624 +Node: Include Files141299 +Node: Loading Shared Libraries144877 +Node: Obsolete146261 +Node: Undocumented146958 +Node: Invoking Summary147225 +Node: Regexp148825 +Node: Regexp Usage150275 +Node: Escape Sequences152308 +Node: Regexp Operators158139 +Ref: Regexp Operators-Footnote-1165619 +Ref: Regexp Operators-Footnote-2165766 +Node: Bracket Expressions165864 +Ref: table-char-classes167754 +Node: GNU Regexp Operators170694 +Node: Case-sensitivity174417 +Ref: Case-sensitivity-Footnote-1177309 +Ref: Case-sensitivity-Footnote-2177544 +Node: Leftmost Longest177652 +Node: Computed Regexps178853 +Node: Regexp Summary182225 +Node: Reading Files183694 +Node: Records185786 +Node: awk split records186529 +Node: gawk split records191387 +Ref: gawk split records-Footnote-1195908 +Node: Fields195945 +Ref: Fields-Footnote-1198909 +Node: Nonconstant Fields198995 +Ref: Nonconstant Fields-Footnote-1201225 +Node: Changing Fields201427 +Node: Field Separators207381 +Node: Default Field Splitting210083 +Node: Regexp Field Splitting211200 +Node: Single Character Fields214541 +Node: Command Line Field Separator215600 +Node: Full Line Fields219026 +Ref: Full Line Fields-Footnote-1219534 +Node: Field Splitting Summary219580 +Ref: Field Splitting Summary-Footnote-1222712 +Node: Constant Size222813 +Node: Splitting By Content227419 +Ref: Splitting By Content-Footnote-1231492 +Node: Multiple Line231532 +Ref: Multiple Line-Footnote-1237388 +Node: Getline237567 +Node: Plain Getline239783 +Node: Getline/Variable241878 +Node: Getline/File243025 +Node: Getline/Variable/File244409 +Ref: Getline/Variable/File-Footnote-1246008 +Node: Getline/Pipe246095 +Node: Getline/Variable/Pipe248794 +Node: Getline/Coprocess249901 +Node: Getline/Variable/Coprocess251153 +Node: Getline Notes251890 +Node: Getline Summary254694 +Ref: table-getline-variants255102 +Node: Read Timeout256014 +Ref: Read Timeout-Footnote-1259841 +Node: Command-line directories259899 +Node: Input Summary260803 +Node: Input Exercises263940 +Node: Printing264673 +Node: Print266395 +Node: Print Examples267736 +Node: Output Separators270515 +Node: OFMT272531 +Node: Printf273889 +Node: Basic Printf274795 +Node: Control Letters276334 +Node: Format Modifiers280325 +Node: Printf Examples286352 +Node: Redirection288816 +Node: Special Files295788 +Node: Special FD296321 +Ref: Special FD-Footnote-1299918 +Node: Special Network299992 +Node: Special Caveats300842 +Node: Close Files And Pipes301638 +Ref: Close Files And Pipes-Footnote-1308799 +Ref: Close Files And Pipes-Footnote-2308947 +Node: Output Summary309097 +Node: Output exercises310094 +Node: Expressions310774 +Node: Values311959 +Node: Constants312635 +Node: Scalar Constants313315 +Ref: Scalar Constants-Footnote-1314174 +Node: Nondecimal-numbers314424 +Node: Regexp Constants317424 +Node: Using Constant Regexps317899 +Node: Variables320971 +Node: Using Variables321626 +Node: Assignment Options323350 +Node: Conversion325225 +Node: Strings And Numbers325749 +Ref: Strings And Numbers-Footnote-1328811 +Node: Locale influences conversions328920 +Ref: table-locale-affects331637 +Node: All Operators332225 +Node: Arithmetic Ops332855 +Node: Concatenation335360 +Ref: Concatenation-Footnote-1338179 +Node: Assignment Ops338299 +Ref: table-assign-ops343282 +Node: Increment Ops344599 +Node: Truth Values and Conditions348037 +Node: Truth Values349120 +Node: Typing and Comparison350169 +Node: Variable Typing350962 +Node: Comparison Operators354614 +Ref: table-relational-ops355024 +Node: POSIX String Comparison358574 +Ref: POSIX String Comparison-Footnote-1359658 +Node: Boolean Ops359796 +Ref: Boolean Ops-Footnote-1363866 +Node: Conditional Exp363957 +Node: Function Calls365684 +Node: Precedence369564 +Node: Locales373233 +Node: Expressions Summary374864 +Node: Patterns and Actions377405 +Node: Pattern Overview378521 +Node: Regexp Patterns380198 +Node: Expression Patterns380741 +Node: Ranges384522 +Node: BEGIN/END387628 +Node: Using BEGIN/END388390 +Ref: Using BEGIN/END-Footnote-1391126 +Node: I/O And BEGIN/END391232 +Node: BEGINFILE/ENDFILE393517 +Node: Empty396448 +Node: Using Shell Variables396765 +Node: Action Overview399048 +Node: Statements401375 +Node: If Statement403223 +Node: While Statement404721 +Node: Do Statement406765 +Node: For Statement407921 +Node: Switch Statement411073 +Node: Break Statement413461 +Node: Continue Statement415516 +Node: Next Statement417355 +Node: Nextfile Statement419745 +Node: Exit Statement422400 +Node: Built-in Variables424804 +Node: User-modified425931 +Ref: User-modified-Footnote-1433620 +Node: Auto-set433682 +Ref: Auto-set-Footnote-1446264 +Ref: Auto-set-Footnote-2446469 +Node: ARGC and ARGV446525 +Node: Pattern Action Summary450429 +Node: Arrays452652 +Node: Array Basics454201 +Node: Array Intro455027 +Ref: figure-array-elements457000 +Node: Reference to Elements459407 +Node: Assigning Elements461786 +Node: Array Example462277 +Node: Scanning an Array464009 +Node: Controlling Scanning467024 +Ref: Controlling Scanning-Footnote-1472197 +Node: Delete472513 +Ref: Delete-Footnote-1475278 +Node: Numeric Array Subscripts475335 +Node: Uninitialized Subscripts477518 +Node: Multidimensional479143 +Node: Multiscanning482256 +Node: Arrays of Arrays483845 +Node: Arrays Summary488508 +Node: Functions490613 +Node: Built-in491486 +Node: Calling Built-in492564 +Node: Numeric Functions494552 +Ref: Numeric Functions-Footnote-1498586 +Ref: Numeric Functions-Footnote-2498943 +Ref: Numeric Functions-Footnote-3498991 +Node: String Functions499260 +Ref: String Functions-Footnote-1522271 +Ref: String Functions-Footnote-2522400 +Ref: String Functions-Footnote-3522648 +Node: Gory Details522735 +Ref: table-sub-escapes524522 +Ref: table-sub-proposed526042 +Ref: table-posix-sub527406 +Ref: table-gensub-escapes528946 +Ref: Gory Details-Footnote-1530122 +Node: I/O Functions530273 +Ref: I/O Functions-Footnote-1537396 +Node: Time Functions537543 +Ref: Time Functions-Footnote-1548007 +Ref: Time Functions-Footnote-2548075 +Ref: Time Functions-Footnote-3548233 +Ref: Time Functions-Footnote-4548344 +Ref: Time Functions-Footnote-5548456 +Ref: Time Functions-Footnote-6548683 +Node: Bitwise Functions548949 +Ref: table-bitwise-ops549511 +Ref: Bitwise Functions-Footnote-1553756 +Node: Type Functions553940 +Node: I18N Functions555082 +Node: User-defined556727 +Node: Definition Syntax557531 +Ref: Definition Syntax-Footnote-1562710 +Node: Function Example562779 +Ref: Function Example-Footnote-1565419 +Node: Function Caveats565441 +Node: Calling A Function565959 +Node: Variable Scope566914 +Node: Pass By Value/Reference569902 +Node: Return Statement573412 +Node: Dynamic Typing576396 +Node: Indirect Calls577325 +Node: Functions Summary587038 +Node: Library Functions589577 +Ref: Library Functions-Footnote-1593195 +Ref: Library Functions-Footnote-2593338 +Node: Library Names593509 +Ref: Library Names-Footnote-1596982 +Ref: Library Names-Footnote-2597202 +Node: General Functions597288 +Node: Strtonum Function598316 +Node: Assert Function601096 +Node: Round Function604422 +Node: Cliff Random Function605963 +Node: Ordinal Functions606979 +Ref: Ordinal Functions-Footnote-1610056 +Ref: Ordinal Functions-Footnote-2610308 +Node: Join Function610519 +Ref: Join Function-Footnote-1612290 +Node: Getlocaltime Function612490 +Node: Readfile Function616226 +Node: Data File Management618065 +Node: Filetrans Function618697 +Node: Rewind Function622766 +Node: File Checking624324 +Ref: File Checking-Footnote-1625456 +Node: Empty Files625657 +Node: Ignoring Assigns627636 +Node: Getopt Function629190 +Ref: Getopt Function-Footnote-1640493 +Node: Passwd Functions640696 +Ref: Passwd Functions-Footnote-1649675 +Node: Group Functions649763 +Ref: Group Functions-Footnote-1657704 +Node: Walking Arrays657917 +Node: Library Functions Summary659520 +Node: Library exercises660908 +Node: Sample Programs662188 +Node: Running Examples662958 +Node: Clones663686 +Node: Cut Program664910 +Node: Egrep Program674778 +Ref: Egrep Program-Footnote-1682749 +Node: Id Program682859 +Node: Split Program686523 +Ref: Split Program-Footnote-1690061 +Node: Tee Program690189 +Node: Uniq Program692996 +Node: Wc Program700426 +Ref: Wc Program-Footnote-1704691 +Node: Miscellaneous Programs704783 +Node: Dupword Program705996 +Node: Alarm Program708027 +Node: Translate Program712841 +Ref: Translate Program-Footnote-1717232 +Ref: Translate Program-Footnote-2717502 +Node: Labels Program717636 +Ref: Labels Program-Footnote-1721007 +Node: Word Sorting721091 +Node: History Sorting725134 +Node: Extract Program726970 +Node: Simple Sed734506 +Node: Igawk Program737568 +Ref: Igawk Program-Footnote-1751872 +Ref: Igawk Program-Footnote-2752073 +Node: Anagram Program752211 +Node: Signature Program755279 +Node: Programs Summary756526 +Node: Programs Exercises757741 +Node: Advanced Features761392 +Node: Nondecimal Data763340 +Node: Array Sorting764917 +Node: Controlling Array Traversal765614 +Node: Array Sorting Functions773894 +Ref: Array Sorting Functions-Footnote-1777801 +Node: Two-way I/O777995 +Ref: Two-way I/O-Footnote-1782939 +Ref: Two-way I/O-Footnote-2783118 +Node: TCP/IP Networking783200 +Node: Profiling786045 +Node: Advanced Features Summary793587 +Node: Internationalization795451 +Node: I18N and L10N796931 +Node: Explaining gettext797617 +Ref: Explaining gettext-Footnote-1802757 +Ref: Explaining gettext-Footnote-2802941 +Node: Programmer i18n803106 +Node: Translator i18n807331 +Node: String Extraction808125 +Ref: String Extraction-Footnote-1809086 +Node: Printf Ordering809172 +Ref: Printf Ordering-Footnote-1811954 +Node: I18N Portability812018 +Ref: I18N Portability-Footnote-1814467 +Node: I18N Example814530 +Ref: I18N Example-Footnote-1817252 +Node: Gawk I18N817324 +Node: I18N Summary817962 +Node: Debugger819301 +Node: Debugging820323 +Node: Debugging Concepts820764 +Node: Debugging Terms822620 +Node: Awk Debugging825217 +Node: Sample Debugging Session826109 +Node: Debugger Invocation826629 +Node: Finding The Bug827962 +Node: List of Debugger Commands834444 +Node: Breakpoint Control835776 +Node: Debugger Execution Control839440 +Node: Viewing And Changing Data842800 +Node: Execution Stack846158 +Node: Debugger Info847671 +Node: Miscellaneous Debugger Commands851665 +Node: Readline Support856849 +Node: Limitations857741 +Node: Debugging Summary860015 +Node: Arbitrary Precision Arithmetic861183 +Node: Computer Arithmetic862670 +Ref: Computer Arithmetic-Footnote-1867057 +Node: Math Definitions867114 +Ref: table-ieee-formats870403 +Ref: Math Definitions-Footnote-1870943 +Node: MPFR features871046 +Node: FP Math Caution872663 +Ref: FP Math Caution-Footnote-1873713 +Node: Inexactness of computations874082 +Node: Inexact representation875030 +Node: Comparing FP Values876385 +Node: Errors accumulate877349 +Node: Getting Accuracy878782 +Node: Try To Round881441 +Node: Setting precision882340 +Ref: table-predefined-precision-strings883022 +Node: Setting the rounding mode884815 +Ref: table-gawk-rounding-modes885179 +Ref: Setting the rounding mode-Footnote-1888633 +Node: Arbitrary Precision Integers888812 +Ref: Arbitrary Precision Integers-Footnote-1891793 +Node: POSIX Floating Point Problems891942 +Ref: POSIX Floating Point Problems-Footnote-1895818 +Node: Floating point summary895856 +Node: Dynamic Extensions898060 +Node: Extension Intro899612 +Node: Plugin License900877 +Node: Extension Mechanism Outline901562 +Ref: figure-load-extension901986 +Ref: figure-load-new-function903471 +Ref: figure-call-new-function904473 +Node: Extension API Description906457 +Node: Extension API Functions Introduction907907 +Node: General Data Types912774 +Ref: General Data Types-Footnote-1918467 +Node: Requesting Values918766 +Ref: table-value-types-returned919503 +Node: Memory Allocation Functions920461 +Ref: Memory Allocation Functions-Footnote-1923208 +Node: Constructor Functions923304 +Node: Registration Functions925062 +Node: Extension Functions925747 +Node: Exit Callback Functions928049 +Node: Extension Version String929297 +Node: Input Parsers929947 +Node: Output Wrappers939761 +Node: Two-way processors944277 +Node: Printing Messages946481 +Ref: Printing Messages-Footnote-1947558 +Node: Updating `ERRNO'947710 +Node: Accessing Parameters948449 +Node: Symbol Table Access949679 +Node: Symbol table by name950193 +Node: Symbol table by cookie952169 +Ref: Symbol table by cookie-Footnote-1956302 +Node: Cached values956365 +Ref: Cached values-Footnote-1959869 +Node: Array Manipulation959960 +Ref: Array Manipulation-Footnote-1961058 +Node: Array Data Types961097 +Ref: Array Data Types-Footnote-1963800 +Node: Array Functions963892 +Node: Flattening Arrays967766 +Node: Creating Arrays974618 +Node: Extension API Variables979349 +Node: Extension Versioning979985 +Node: Extension API Informational Variables981886 +Node: Extension API Boilerplate982972 +Node: Finding Extensions986776 +Node: Extension Example987336 +Node: Internal File Description988066 +Node: Internal File Ops992157 +Ref: Internal File Ops-Footnote-11003589 +Node: Using Internal File Ops1003729 +Ref: Using Internal File Ops-Footnote-11006076 +Node: Extension Samples1006344 +Node: Extension Sample File Functions1007868 +Node: Extension Sample Fnmatch1015436 +Node: Extension Sample Fork1016918 +Node: Extension Sample Inplace1018131 +Node: Extension Sample Ord1019806 +Node: Extension Sample Readdir1020642 +Ref: table-readdir-file-types1021498 +Node: Extension Sample Revout1022297 +Node: Extension Sample Rev2way1022888 +Node: Extension Sample Read write array1023629 +Node: Extension Sample Readfile1025508 +Node: Extension Sample API Tests1026608 +Node: Extension Sample Time1027133 +Node: gawkextlib1028448 +Node: Extension summary1031261 +Node: Extension Exercises1034954 +Node: Language History1035676 +Node: V7/SVR3.11037319 +Node: SVR41039639 +Node: POSIX1041081 +Node: BTL1042467 +Node: POSIX/GNU1043201 +Node: Feature History1048942 +Node: Common Extensions1062072 +Node: Ranges and Locales1063384 +Ref: Ranges and Locales-Footnote-11068001 +Ref: Ranges and Locales-Footnote-21068028 +Ref: Ranges and Locales-Footnote-31068262 +Node: Contributors1068483 +Node: History summary1073908 +Node: Installation1075277 +Node: Gawk Distribution1076228 +Node: Getting1076712 +Node: Extracting1077536 +Node: Distribution contents1079178 +Node: Unix Installation1084895 +Node: Quick Installation1085512 +Node: Additional Configuration Options1087954 +Node: Configuration Philosophy1089692 +Node: Non-Unix Installation1092043 +Node: PC Installation1092501 +Node: PC Binary Installation1093812 +Node: PC Compiling1095660 +Ref: PC Compiling-Footnote-11098659 +Node: PC Testing1098764 +Node: PC Using1099940 +Node: Cygwin1104092 +Node: MSYS1104901 +Node: VMS Installation1105415 +Node: VMS Compilation1106211 +Ref: VMS Compilation-Footnote-11107433 +Node: VMS Dynamic Extensions1107491 +Node: VMS Installation Details1108864 +Node: VMS Running1111116 +Node: VMS GNV1113950 +Node: VMS Old Gawk1114673 +Node: Bugs1115143 +Node: Other Versions1119147 +Node: Installation summary1125402 +Node: Notes1126458 +Node: Compatibility Mode1127323 +Node: Additions1128105 +Node: Accessing The Source1129030 +Node: Adding Code1130466 +Node: New Ports1136644 +Node: Derived Files1141125 +Ref: Derived Files-Footnote-11146206 +Ref: Derived Files-Footnote-21146240 +Ref: Derived Files-Footnote-31146836 +Node: Future Extensions1146950 +Node: Implementation Limitations1147556 +Node: Extension Design1148804 +Node: Old Extension Problems1149958 +Ref: Old Extension Problems-Footnote-11151475 +Node: Extension New Mechanism Goals1151532 +Ref: Extension New Mechanism Goals-Footnote-11154892 +Node: Extension Other Design Decisions1155081 +Node: Extension Future Growth1157187 +Node: Old Extension Mechanism1158023 +Node: Notes summary1159785 +Node: Basic Concepts1160971 +Node: Basic High Level1161652 +Ref: figure-general-flow1161924 +Ref: figure-process-flow1162523 +Ref: Basic High Level-Footnote-11165752 +Node: Basic Data Typing1165937 +Node: Glossary1169265 +Node: Copying1194417 +Node: GNU Free Documentation License1231973 +Node: Index1257109 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index c30c2808..696e2a38 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -1211,23 +1211,19 @@ March, 2001 </prefaceinfo> @end docbook -Several kinds of tasks occur repeatedly -when working with text files. -You might want to extract certain lines and discard the rest. -Or you may need to make changes wherever certain patterns appear, -but leave the rest of the file alone. -Writing single-use programs for these tasks in languages such as C, C++, -or Java is time-consuming and inconvenient. -Such jobs are often easier with @command{awk}. -The @command{awk} utility interprets a special-purpose programming language -that makes it easy to handle simple data-reformatting jobs. +Several kinds of tasks occur repeatedly when working with text files. +You might want to extract certain lines and discard the rest. Or you +may need to make changes wherever certain patterns appear, but leave the +rest of the file alone. Such jobs are often easy with @command{awk}. +The @command{awk} utility interprets a special-purpose programming +language that makes it easy to handle simple data-reformatting jobs. @cindex Brian Kernighan's @command{awk} The GNU implementation of @command{awk} is called @command{gawk}; if you invoke it with the proper options or environment variables (@pxref{Options}), it is fully compatible with -the POSIX@footnote{The 2008 POSIX standard is accessable online at +the POSIX@footnote{The 2008 POSIX standard is accessible online at @w{@url{http://www.opengroup.org/onlinepubs/9699919799/}.}} specification of the @command{awk} language and with the Unix version of @command{awk} maintained @@ -1301,7 +1297,7 @@ different computing environments. This @value{DOCUMENT}, while describing the @command{awk} language in general, also describes the particular implementation of @command{awk} called @command{gawk} (which stands for ``GNU @command{awk}''). @command{gawk} runs on a broad range of Unix systems, -ranging from Intel@registeredsymbol{}-architecture PC-based computers +ranging from Intel-architecture PC-based computers up through large-scale systems. @command{gawk} has also been ported to Mac OS X, Microsoft Windows @@ -1777,7 +1773,7 @@ more than one @command{awk} implementation are marked and ``extensions, common.'' @end ifclear @ifset FOR_PRINT -``@value{COMMONEXT}.'' +``@value{COMMONEXT}'' for ``common extension.'' @end ifset @node Manual History @@ -1829,7 +1825,7 @@ stage of development. @cindex operating systems, BSD-based Until the GNU operating system is more fully developed, you should consider using GNU/Linux, a freely distributable, Unix-like operating -system for Intel@registeredsymbol{}, +system for Intel, Power Architecture, Sun SPARC, IBM S/390, and other systems.@footnote{The terminology ``GNU/Linux'' is explained @@ -3411,19 +3407,13 @@ version of @command{awk} has fewer predefined limits, and those that it has are much larger than they used to be. @cindex @command{awk} programs, complex -If you find yourself writing @command{awk} scripts of more than, say, a few -hundred lines, you might consider using a different programming -language. -The shell is good at string and -pattern matching; in addition, it allows powerful use of the system -utilities. More conventional languages, such as C, C++, and Java, offer -better facilities for system programming and for managing the complexity -of large programs. -Python offers a nice balance between high-level ease of programming and -access to system facilities. -Programs in these languages may require more lines -of source code than the equivalent @command{awk} programs, but they are -easier to maintain and usually run more efficiently. +If you find yourself writing @command{awk} scripts of more than, say, +a few hundred lines, you might consider using a different programming +language. The shell is good at string and pattern matching; in addition, +it allows powerful use of the system utilities. Python offers a nice +balance between high-level ease of programming and access to system +facilities.@footnote{Other popular scripting languages include Ruby +and Perl.} @node Intro Summary @section Summary @@ -3739,7 +3729,7 @@ Command-line variable assignments of the form This option is particularly necessary for World Wide Web CGI applications that pass arguments through the URL; using this option prevents a malicious (or other) user from passing in options, assignments, or @command{awk} source -code (via @option{--source}) to the CGI application. This option should be used +code (via @option{-e}) to the CGI application. This option should be used with @samp{#!} scripts (@pxref{Executable Scripts}), like so: @example @@ -4027,14 +4017,14 @@ source of data.) Because it is clumsy using the standard @command{awk} mechanisms to mix source file and command-line @command{awk} programs, @command{gawk} -provides the @option{--source} option. This does not require you to +provides the @option{-e} option. This does not require you to pre-empt the standard input for your source code; it allows you to easily mix command-line and library source code (@pxref{AWKPATH Variable}). -As with @option{-f}, the @option{--source} and @option{--include} +As with @option{-f}, the @option{-e} and @option{-i} options may also be used multiple times on the command line. -@cindex @option{--source} option -If no @option{-f} or @option{--source} option is specified, then @command{gawk} +@cindex @option{-e} option +If no @option{-f} or @option{-e} option is specified, then @command{gawk} uses the first non-option command-line argument as the text of the program source code. @@ -4230,7 +4220,7 @@ standard directory in the default path and then specified on the command line with a short @value{FN}. Otherwise, the full @value{FN} would have to be typed for each file. -By using the @option{-i} option, or the @option{--source} and @option{-f} options, your command-line +By using the @option{-i} option, or the @option{-e} and @option{-f} options, your command-line @command{awk} programs can use facilities in @command{awk} library files (@pxref{Library Functions}). Path searching is not done if @command{gawk} is in compatibility mode. @@ -4944,6 +4934,12 @@ However, using more than two hexadecimal digits produces undefined results. (The @samp{\x} escape sequence is not allowed in POSIX @command{awk}.) +@quotation CAUTION +The next major relase of @command{gawk} will change, such +that a maximum of two hexadecimal digits following the +@samp{\x} will be used. +@end quotation + @cindex @code{\} (backslash), @code{\/} escape sequence @cindex backslash (@code{\}), @code{\/} escape sequence @item \/ @@ -13821,31 +13817,38 @@ case is made, the case statement bodies execute until a @code{break}, or the end of the @code{switch} statement itself. For example: @example -switch (NR * 2 + 1) @{ -case 3: -case "11": - print NR - 1 - break - -case /2[[:digit:]]+/: - print NR - -default: - print NR + 1 - -case -1: - print NR * -1 +while ((c = getopt(ARGC, ARGV, "aksx")) != -1) @{ + switch (c) @{ + case "a": + # report size of all files + all_files = TRUE; + break + case "k": + BLOCK_SIZE = 1024 # 1K block size + break + case "s": + # do sums only + sum_only = TRUE + break + case "x": + # don't cross filesystems + fts_flags = or(fts_flags, FTS_XDEV) + break + case "?": + default: + usage() + break + @} @} @end example Note that if none of the statements specified above halt execution of a matched @code{case} statement, execution falls through to the -next @code{case} until execution halts. In the above example, for -any case value starting with @samp{2} followed by one or more digits, -the @code{print} statement is executed and then falls through into the -@code{default} section, executing its @code{print} statement. In turn, -the @minus{}1 case will also be executed since the @code{default} does -not halt execution. +next @code{case} until execution halts. In the above example, the +@code{case} for @code{"?"} falls through to the @code{default} +case, which is to call a function named @code{usage()}. +(The @code{getopt()} function being called here is +described in @ref{Getopt Function}.) @node Break Statement @subsection The @code{break} Statement @@ -13968,7 +13971,8 @@ BEGIN @{ @end example @noindent -This program loops forever once @code{x} reaches 5. +This program loops forever once @code{x} reaches 5, since +the increment (@samp{x++}) is never reached. @c @cindex @code{continue}, outside of loops @c @cindex historical features @@ -15018,8 +15022,17 @@ before actual processing of the input begins. @xref{Split Program}, and see @ref{Tee Program}, for examples of each way of removing elements from @code{ARGV}. + +To actually get options into an @command{awk} program, +end the @command{awk} options with @option{--} and then supply +the @command{awk} program's options, in the following manner: + +@example +awk -f myprog.awk -- -v -q file1 file2 @dots{} +@end example + The following fragment processes @code{ARGV} in order to examine, and -then remove, command-line options: +then remove, the above command-line options: @example BEGIN @{ @@ -15039,32 +15052,24 @@ BEGIN @{ @} @end example -To actually get the options into the @command{awk} program, -end the @command{awk} options with @option{--} and then supply -the @command{awk} program's options, in the following manner: - -@example -awk -f myprog -- -v -q file1 file2 @dots{} -@end example - @cindex differences in @command{awk} and @command{gawk}, @code{ARGC}/@code{ARGV} variables -This is not necessary in @command{gawk}. Unless @option{--posix} has +Ending the @command{awk} options with @option{--} isn't +necessary in @command{gawk}. Unless @option{--posix} has been specified, @command{gawk} silently puts any unrecognized options into @code{ARGV} for the @command{awk} program to deal with. As soon as it sees an unknown option, @command{gawk} stops looking for other -options that it might otherwise recognize. The previous example with +options that it might otherwise recognize. The previous command line with @command{gawk} would be: @example -gawk -f myprog -q -v file1 file2 @dots{} +gawk -f myprog.awk -q -v file1 file2 @dots{} @end example @noindent -Because @option{-q} is not a valid @command{gawk} option, -it and the following @option{-v} -are passed on to the @command{awk} program. -(@xref{Getopt Function}, for an @command{awk} library function -that parses command-line options.) +Because @option{-q} is not a valid @command{gawk} option, it and the +following @option{-v} are passed on to the @command{awk} program. +(@xref{Getopt Function}, for an @command{awk} library function that +parses command-line options.) @node Pattern Action Summary @section Summary @@ -15509,8 +15514,9 @@ if (a["foo"] != "") @dots{} @end example @noindent -This is incorrect, since this will @emph{create} @code{a["foo"]} -if it didn't exist before! +This is incorrect for two reasons. First, it @emph{creates} @code{a["foo"]} +if it didn't exist before! Second, it is valid (if a bit unusual) to set +an array element equal to the empty string. @end quotation @c @cindex arrays, @code{in} operator and @@ -16194,10 +16200,11 @@ used for single dimensional arrays. Write the whole sequence of indices in parentheses, separated by commas, as the left operand: @example -(@var{subscript1}, @var{subscript2}, @dots{}) in @var{array} +if ((@var{subscript1}, @var{subscript2}, @dots{}) in @var{array}) + @dots{} @end example -The following example treats its input as a two-dimensional array of +Here is an example that treats its input as a two-dimensional array of fields; it rotates this array 90 degrees clockwise and prints the result. It assumes that all lines have the same number of elements: @@ -16754,6 +16761,9 @@ numbers that are truly unpredictable. The return value of @code{srand()} is the previous seed. This makes it easy to keep track of the seeds in case you need to consistently reproduce sequences of random numbers. + +POSIX does not specify the initial seed; it differs among @command{awk} +implementations. @end table @node String Functions @@ -19181,7 +19191,8 @@ this program, using our function to format the results, prints: 21.2 @end example -This function deletes all the elements in an array: +This function deletes all the elements in an array (recall that the +extra whitespace signifies the start of the local variable list): @example function delarray(a, i) @@ -19224,7 +19235,7 @@ this way: @example $ @kbd{echo "Don't Panic!" |} -> @kbd{gawk --source '@{ print rev($0) @}' -f rev.awk} +> @kbd{gawk -e '@{ print rev($0) @}' -f rev.awk} @print{} !cinaP t'noD @end example @@ -20150,7 +20161,7 @@ of good programs leads to better writing. In fact, they felt this idea was so important that they placed this statement on the cover of their book. Because we believe strongly that their statement is correct, this @value{CHAPTER} and @ref{Sample -Programs}, provide a good-sized body of code for you to read, and we hope, +Programs}, provide a good-sized body of code for you to read and, we hope, to learn from. This @value{CHAPTER} presents a library of useful @command{awk} functions. @@ -25519,7 +25530,7 @@ a shell variable that will be expanded. There are two cases: @enumerate a @item -Literal text, provided with @option{--source} or @option{--source=}. This +Literal text, provided with @option{-e} or @option{--source}. This text is just appended directly. @item @@ -29698,7 +29709,7 @@ similarly to the GNU Debugger, GDB. @item Debuggers let you step through your program one statement at a time, examine and change variable and array values, and do a number of other -things that let understand what your program is actually doing (as +things that let you understand what your program is actually doing (as opposed to what it is supposed to do). @item @@ -29984,8 +29995,8 @@ array to provide information about the MPFR and GMP libraries The MPFR library provides precise control over precisions and rounding modes, and gives correctly rounded, reproducible, platform-independent -results. With either of the command-line options @option{--bignum} or -@option{-M}, all floating-point arithmetic operators and numeric functions +results. With the @option{-M} command-line option, +all floating-point arithmetic operators and numeric functions can yield results to any desired precision level supported by MPFR. Two built-in variables, @code{PREC} and @code{ROUNDMODE}, @@ -29999,7 +30010,7 @@ to follow. @quotation Math class is tough! -@author Teen Talk Barbie (July, 1992) +@author Teen Talk Barbie, July 1992 @end quotation This @value{SECTION} provides a high level overview of the issues @@ -30411,7 +30422,7 @@ output when you change the rounding mode to be sure. @cindex integers, arbitrary precision @cindex arbitrary precision integers -When given one of the options @option{--bignum} or @option{-M}, +When given the @option{-M} option, @command{gawk} performs all integer arithmetic using GMP arbitrary precision integers. Any number that looks like an integer in a source or @value{DF} is stored as an arbitrary precision integer. The size @@ -30653,12 +30664,12 @@ Often, increasing the accuracy and then rounding to the desired number of digits produces reasonable results. @item -Use either @option{-M} or @option{--bignum} to enable MPFR +Use @option{-M} (or @option{--bignum}) to enable MPFR arithmetic. Use @code{PREC} to set the precision in bits, and @code{ROUNDMODE} to set the IEEE 754 rounding mode. @item -With @option{-M} or @option{--bignum}, @command{gawk} performs +With @option{-M}, @command{gawk} performs arbitrary precision integer arithmetic using the GMP library. This is faster and more space efficient than using MPFR for the same calculations. @@ -31041,7 +31052,7 @@ does not support this keyword, you should either place @file{config.h} file in your extensions. @item -All pointers filled in by @command{gawk} are to memory +All pointers filled in by @command{gawk} point to memory managed by @command{gawk} and should be treated by the extension as read-only. Memory for @emph{all} strings passed into @command{gawk} from the extension @emph{must} come from calling the API-provided function @@ -31575,8 +31586,8 @@ empty string (@code{""}). The @code{func} pointer is the address of a An @dfn{exit callback} function is a function that @command{gawk} calls before it exits. Such functions are useful if you have general ``cleanup'' tasks -that should be performed in your extension (such as closing data -base connections or other resource deallocations). +that should be performed in your extension (such as closing database +connections or other resource deallocations). You can register such a function with @command{gawk} using the following function. @@ -35255,7 +35266,7 @@ and the @option{--copyright}, @option{--debug}, @option{--dump-variables}, -@option{--execle}, +@option{--exec}, @option{--field-separator}, @option{--file}, @option{--gen-pot}, @@ -37252,7 +37263,7 @@ The following changes the record separator to @code{"\r\n"} and sets binary mode on reads, but does not affect the mode on standard input: @example -gawk -v RS="\r\n" --source "BEGIN @{ BINMODE = 1 @}" @dots{} +gawk -v RS="\r\n" -e "BEGIN @{ BINMODE = 1 @}" @dots{} @end example @noindent @@ -38948,7 +38959,7 @@ compiled with @samp{-DDEBUG}. @item The source code for @command{gawk} is maintained in a publicly -accessable Git repository. Anyone may check it out and view the source. +accessible Git repository. Anyone may check it out and view the source. @item Contributions to @command{gawk} are welcome. Following the steps diff --git a/doc/gawktexi.in b/doc/gawktexi.in index aed8cbd7..43c4976c 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -1206,23 +1206,19 @@ March, 2001 </prefaceinfo> @end docbook -Several kinds of tasks occur repeatedly -when working with text files. -You might want to extract certain lines and discard the rest. -Or you may need to make changes wherever certain patterns appear, -but leave the rest of the file alone. -Writing single-use programs for these tasks in languages such as C, C++, -or Java is time-consuming and inconvenient. -Such jobs are often easier with @command{awk}. -The @command{awk} utility interprets a special-purpose programming language -that makes it easy to handle simple data-reformatting jobs. +Several kinds of tasks occur repeatedly when working with text files. +You might want to extract certain lines and discard the rest. Or you +may need to make changes wherever certain patterns appear, but leave the +rest of the file alone. Such jobs are often easy with @command{awk}. +The @command{awk} utility interprets a special-purpose programming +language that makes it easy to handle simple data-reformatting jobs. @cindex Brian Kernighan's @command{awk} The GNU implementation of @command{awk} is called @command{gawk}; if you invoke it with the proper options or environment variables (@pxref{Options}), it is fully compatible with -the POSIX@footnote{The 2008 POSIX standard is accessable online at +the POSIX@footnote{The 2008 POSIX standard is accessible online at @w{@url{http://www.opengroup.org/onlinepubs/9699919799/}.}} specification of the @command{awk} language and with the Unix version of @command{awk} maintained @@ -1296,7 +1292,7 @@ different computing environments. This @value{DOCUMENT}, while describing the @command{awk} language in general, also describes the particular implementation of @command{awk} called @command{gawk} (which stands for ``GNU @command{awk}''). @command{gawk} runs on a broad range of Unix systems, -ranging from Intel@registeredsymbol{}-architecture PC-based computers +ranging from Intel-architecture PC-based computers up through large-scale systems. @command{gawk} has also been ported to Mac OS X, Microsoft Windows @@ -1744,7 +1740,7 @@ more than one @command{awk} implementation are marked and ``extensions, common.'' @end ifclear @ifset FOR_PRINT -``@value{COMMONEXT}.'' +``@value{COMMONEXT}'' for ``common extension.'' @end ifset @node Manual History @@ -1796,7 +1792,7 @@ stage of development. @cindex operating systems, BSD-based Until the GNU operating system is more fully developed, you should consider using GNU/Linux, a freely distributable, Unix-like operating -system for Intel@registeredsymbol{}, +system for Intel, Power Architecture, Sun SPARC, IBM S/390, and other systems.@footnote{The terminology ``GNU/Linux'' is explained @@ -3339,19 +3335,13 @@ version of @command{awk} has fewer predefined limits, and those that it has are much larger than they used to be. @cindex @command{awk} programs, complex -If you find yourself writing @command{awk} scripts of more than, say, a few -hundred lines, you might consider using a different programming -language. -The shell is good at string and -pattern matching; in addition, it allows powerful use of the system -utilities. More conventional languages, such as C, C++, and Java, offer -better facilities for system programming and for managing the complexity -of large programs. -Python offers a nice balance between high-level ease of programming and -access to system facilities. -Programs in these languages may require more lines -of source code than the equivalent @command{awk} programs, but they are -easier to maintain and usually run more efficiently. +If you find yourself writing @command{awk} scripts of more than, say, +a few hundred lines, you might consider using a different programming +language. The shell is good at string and pattern matching; in addition, +it allows powerful use of the system utilities. Python offers a nice +balance between high-level ease of programming and access to system +facilities.@footnote{Other popular scripting languages include Ruby +and Perl.} @node Intro Summary @section Summary @@ -3667,7 +3657,7 @@ Command-line variable assignments of the form This option is particularly necessary for World Wide Web CGI applications that pass arguments through the URL; using this option prevents a malicious (or other) user from passing in options, assignments, or @command{awk} source -code (via @option{--source}) to the CGI application. This option should be used +code (via @option{-e}) to the CGI application. This option should be used with @samp{#!} scripts (@pxref{Executable Scripts}), like so: @example @@ -3955,14 +3945,14 @@ source of data.) Because it is clumsy using the standard @command{awk} mechanisms to mix source file and command-line @command{awk} programs, @command{gawk} -provides the @option{--source} option. This does not require you to +provides the @option{-e} option. This does not require you to pre-empt the standard input for your source code; it allows you to easily mix command-line and library source code (@pxref{AWKPATH Variable}). -As with @option{-f}, the @option{--source} and @option{--include} +As with @option{-f}, the @option{-e} and @option{-i} options may also be used multiple times on the command line. -@cindex @option{--source} option -If no @option{-f} or @option{--source} option is specified, then @command{gawk} +@cindex @option{-e} option +If no @option{-f} or @option{-e} option is specified, then @command{gawk} uses the first non-option command-line argument as the text of the program source code. @@ -4158,7 +4148,7 @@ standard directory in the default path and then specified on the command line with a short @value{FN}. Otherwise, the full @value{FN} would have to be typed for each file. -By using the @option{-i} option, or the @option{--source} and @option{-f} options, your command-line +By using the @option{-i} option, or the @option{-e} and @option{-f} options, your command-line @command{awk} programs can use facilities in @command{awk} library files (@pxref{Library Functions}). Path searching is not done if @command{gawk} is in compatibility mode. @@ -4872,6 +4862,12 @@ However, using more than two hexadecimal digits produces undefined results. (The @samp{\x} escape sequence is not allowed in POSIX @command{awk}.) +@quotation CAUTION +The next major relase of @command{gawk} will change, such +that a maximum of two hexadecimal digits following the +@samp{\x} will be used. +@end quotation + @cindex @code{\} (backslash), @code{\/} escape sequence @cindex backslash (@code{\}), @code{\/} escape sequence @item \/ @@ -13172,31 +13168,38 @@ case is made, the case statement bodies execute until a @code{break}, or the end of the @code{switch} statement itself. For example: @example -switch (NR * 2 + 1) @{ -case 3: -case "11": - print NR - 1 - break - -case /2[[:digit:]]+/: - print NR - -default: - print NR + 1 - -case -1: - print NR * -1 +while ((c = getopt(ARGC, ARGV, "aksx")) != -1) @{ + switch (c) @{ + case "a": + # report size of all files + all_files = TRUE; + break + case "k": + BLOCK_SIZE = 1024 # 1K block size + break + case "s": + # do sums only + sum_only = TRUE + break + case "x": + # don't cross filesystems + fts_flags = or(fts_flags, FTS_XDEV) + break + case "?": + default: + usage() + break + @} @} @end example Note that if none of the statements specified above halt execution of a matched @code{case} statement, execution falls through to the -next @code{case} until execution halts. In the above example, for -any case value starting with @samp{2} followed by one or more digits, -the @code{print} statement is executed and then falls through into the -@code{default} section, executing its @code{print} statement. In turn, -the @minus{}1 case will also be executed since the @code{default} does -not halt execution. +next @code{case} until execution halts. In the above example, the +@code{case} for @code{"?"} falls through to the @code{default} +case, which is to call a function named @code{usage()}. +(The @code{getopt()} function being called here is +described in @ref{Getopt Function}.) @node Break Statement @subsection The @code{break} Statement @@ -13319,7 +13322,8 @@ BEGIN @{ @end example @noindent -This program loops forever once @code{x} reaches 5. +This program loops forever once @code{x} reaches 5, since +the increment (@samp{x++}) is never reached. @c @cindex @code{continue}, outside of loops @c @cindex historical features @@ -14323,8 +14327,17 @@ before actual processing of the input begins. @xref{Split Program}, and see @ref{Tee Program}, for examples of each way of removing elements from @code{ARGV}. + +To actually get options into an @command{awk} program, +end the @command{awk} options with @option{--} and then supply +the @command{awk} program's options, in the following manner: + +@example +awk -f myprog.awk -- -v -q file1 file2 @dots{} +@end example + The following fragment processes @code{ARGV} in order to examine, and -then remove, command-line options: +then remove, the above command-line options: @example BEGIN @{ @@ -14344,32 +14357,24 @@ BEGIN @{ @} @end example -To actually get the options into the @command{awk} program, -end the @command{awk} options with @option{--} and then supply -the @command{awk} program's options, in the following manner: - -@example -awk -f myprog -- -v -q file1 file2 @dots{} -@end example - @cindex differences in @command{awk} and @command{gawk}, @code{ARGC}/@code{ARGV} variables -This is not necessary in @command{gawk}. Unless @option{--posix} has +Ending the @command{awk} options with @option{--} isn't +necessary in @command{gawk}. Unless @option{--posix} has been specified, @command{gawk} silently puts any unrecognized options into @code{ARGV} for the @command{awk} program to deal with. As soon as it sees an unknown option, @command{gawk} stops looking for other -options that it might otherwise recognize. The previous example with +options that it might otherwise recognize. The previous command line with @command{gawk} would be: @example -gawk -f myprog -q -v file1 file2 @dots{} +gawk -f myprog.awk -q -v file1 file2 @dots{} @end example @noindent -Because @option{-q} is not a valid @command{gawk} option, -it and the following @option{-v} -are passed on to the @command{awk} program. -(@xref{Getopt Function}, for an @command{awk} library function -that parses command-line options.) +Because @option{-q} is not a valid @command{gawk} option, it and the +following @option{-v} are passed on to the @command{awk} program. +(@xref{Getopt Function}, for an @command{awk} library function that +parses command-line options.) @node Pattern Action Summary @section Summary @@ -14814,8 +14819,9 @@ if (a["foo"] != "") @dots{} @end example @noindent -This is incorrect, since this will @emph{create} @code{a["foo"]} -if it didn't exist before! +This is incorrect for two reasons. First, it @emph{creates} @code{a["foo"]} +if it didn't exist before! Second, it is valid (if a bit unusual) to set +an array element equal to the empty string. @end quotation @c @cindex arrays, @code{in} operator and @@ -15499,10 +15505,11 @@ used for single dimensional arrays. Write the whole sequence of indices in parentheses, separated by commas, as the left operand: @example -(@var{subscript1}, @var{subscript2}, @dots{}) in @var{array} +if ((@var{subscript1}, @var{subscript2}, @dots{}) in @var{array}) + @dots{} @end example -The following example treats its input as a two-dimensional array of +Here is an example that treats its input as a two-dimensional array of fields; it rotates this array 90 degrees clockwise and prints the result. It assumes that all lines have the same number of elements: @@ -16059,6 +16066,9 @@ numbers that are truly unpredictable. The return value of @code{srand()} is the previous seed. This makes it easy to keep track of the seeds in case you need to consistently reproduce sequences of random numbers. + +POSIX does not specify the initial seed; it differs among @command{awk} +implementations. @end table @node String Functions @@ -18325,7 +18335,8 @@ this program, using our function to format the results, prints: 21.2 @end example -This function deletes all the elements in an array: +This function deletes all the elements in an array (recall that the +extra whitespace signifies the start of the local variable list): @example function delarray(a, i) @@ -18368,7 +18379,7 @@ this way: @example $ @kbd{echo "Don't Panic!" |} -> @kbd{gawk --source '@{ print rev($0) @}' -f rev.awk} +> @kbd{gawk -e '@{ print rev($0) @}' -f rev.awk} @print{} !cinaP t'noD @end example @@ -19294,7 +19305,7 @@ of good programs leads to better writing. In fact, they felt this idea was so important that they placed this statement on the cover of their book. Because we believe strongly that their statement is correct, this @value{CHAPTER} and @ref{Sample -Programs}, provide a good-sized body of code for you to read, and we hope, +Programs}, provide a good-sized body of code for you to read and, we hope, to learn from. This @value{CHAPTER} presents a library of useful @command{awk} functions. @@ -24634,7 +24645,7 @@ a shell variable that will be expanded. There are two cases: @enumerate a @item -Literal text, provided with @option{--source} or @option{--source=}. This +Literal text, provided with @option{-e} or @option{--source}. This text is just appended directly. @item @@ -28813,7 +28824,7 @@ similarly to the GNU Debugger, GDB. @item Debuggers let you step through your program one statement at a time, examine and change variable and array values, and do a number of other -things that let understand what your program is actually doing (as +things that let you understand what your program is actually doing (as opposed to what it is supposed to do). @item @@ -29099,8 +29110,8 @@ array to provide information about the MPFR and GMP libraries The MPFR library provides precise control over precisions and rounding modes, and gives correctly rounded, reproducible, platform-independent -results. With either of the command-line options @option{--bignum} or -@option{-M}, all floating-point arithmetic operators and numeric functions +results. With the @option{-M} command-line option, +all floating-point arithmetic operators and numeric functions can yield results to any desired precision level supported by MPFR. Two built-in variables, @code{PREC} and @code{ROUNDMODE}, @@ -29114,7 +29125,7 @@ to follow. @quotation Math class is tough! -@author Teen Talk Barbie (July, 1992) +@author Teen Talk Barbie, July 1992 @end quotation This @value{SECTION} provides a high level overview of the issues @@ -29526,7 +29537,7 @@ output when you change the rounding mode to be sure. @cindex integers, arbitrary precision @cindex arbitrary precision integers -When given one of the options @option{--bignum} or @option{-M}, +When given the @option{-M} option, @command{gawk} performs all integer arithmetic using GMP arbitrary precision integers. Any number that looks like an integer in a source or @value{DF} is stored as an arbitrary precision integer. The size @@ -29768,12 +29779,12 @@ Often, increasing the accuracy and then rounding to the desired number of digits produces reasonable results. @item -Use either @option{-M} or @option{--bignum} to enable MPFR +Use @option{-M} (or @option{--bignum}) to enable MPFR arithmetic. Use @code{PREC} to set the precision in bits, and @code{ROUNDMODE} to set the IEEE 754 rounding mode. @item -With @option{-M} or @option{--bignum}, @command{gawk} performs +With @option{-M}, @command{gawk} performs arbitrary precision integer arithmetic using the GMP library. This is faster and more space efficient than using MPFR for the same calculations. @@ -30156,7 +30167,7 @@ does not support this keyword, you should either place @file{config.h} file in your extensions. @item -All pointers filled in by @command{gawk} are to memory +All pointers filled in by @command{gawk} point to memory managed by @command{gawk} and should be treated by the extension as read-only. Memory for @emph{all} strings passed into @command{gawk} from the extension @emph{must} come from calling the API-provided function @@ -30690,8 +30701,8 @@ empty string (@code{""}). The @code{func} pointer is the address of a An @dfn{exit callback} function is a function that @command{gawk} calls before it exits. Such functions are useful if you have general ``cleanup'' tasks -that should be performed in your extension (such as closing data -base connections or other resource deallocations). +that should be performed in your extension (such as closing database +connections or other resource deallocations). You can register such a function with @command{gawk} using the following function. @@ -34370,7 +34381,7 @@ and the @option{--copyright}, @option{--debug}, @option{--dump-variables}, -@option{--execle}, +@option{--exec}, @option{--field-separator}, @option{--file}, @option{--gen-pot}, @@ -36367,7 +36378,7 @@ The following changes the record separator to @code{"\r\n"} and sets binary mode on reads, but does not affect the mode on standard input: @example -gawk -v RS="\r\n" --source "BEGIN @{ BINMODE = 1 @}" @dots{} +gawk -v RS="\r\n" -e "BEGIN @{ BINMODE = 1 @}" @dots{} @end example @noindent @@ -38063,7 +38074,7 @@ compiled with @samp{-DDEBUG}. @item The source code for @command{gawk} is maintained in a publicly -accessable Git repository. Anyone may check it out and view the source. +accessible Git repository. Anyone may check it out and view the source. @item Contributions to @command{gawk} are welcome. Following the steps |