diff options
Diffstat (limited to 'doc/gawk.info')
-rw-r--r-- | doc/gawk.info | 2427 |
1 files changed, 1298 insertions, 1129 deletions
diff --git a/doc/gawk.info b/doc/gawk.info index 10085b35..e399353b 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -2280,9 +2280,10 @@ built-in functions for working with timestamps, performing bit manipulation, for runtime string translation (internationalization), determining the type of a variable, and array sorting. - As we develop our presentation of the `awk' language, we introduce -most of the variables and many of the functions. They are described -systematically in *note Built-in Variables::, and in *note Built-in::. + As we develop our presentation of the `awk' language, we will +introduce most of the variables and many of the functions. They are +described systematically in *note Built-in Variables::, and in *note +Built-in::. File: gawk.info, Node: When, Next: Intro Summary, Prev: Other Features, Up: Getting Started @@ -2347,7 +2348,7 @@ File: gawk.info, Node: Intro Summary, Prev: When, Up: Getting Started * You may use backslash continuation to continue a source line. Lines are automatically continued after a comma, open brace, - question mark, colon, `||', `&&', `do' and `else'. + question mark, colon, `||', `&&', `do', and `else'. File: gawk.info, Node: Invoking Gawk, Next: Regexp, Prev: Getting Started, Up: Top @@ -2414,8 +2415,8 @@ File: gawk.info, Node: Options, Next: Other Arguments, Prev: Command Line, U Options begin with a dash and consist of a single character. GNU-style long options consist of two dashes and a keyword. The keyword can be abbreviated, as long as the abbreviation allows the option to be -uniquely identified. If the option takes an argument, then the keyword -is either immediately followed by an equals sign (`=') and the +uniquely identified. If the option takes an argument, either the +keyword is immediately followed by an equals sign (`=') and the argument's value, or the keyword and the argument's value are separated by whitespace. If a particular option with a value is given more than once, it is the last value that counts. @@ -2430,10 +2431,10 @@ The following list describes options mandated by the POSIX standard: `-f SOURCE-FILE' `--file SOURCE-FILE' - Read `awk' program source from SOURCE-FILE instead of in the first - nonoption argument. This option may be given multiple times; the - `awk' program consists of the concatenation of the contents of - each specified SOURCE-FILE. + Read the `awk' program source from SOURCE-FILE instead of in the + first nonoption argument. This option may be given multiple + times; the `awk' program consists of the concatenation of the + contents of each specified SOURCE-FILE. `-v VAR=VAL' `--assign VAR=VAL' @@ -2474,7 +2475,7 @@ The following list describes options mandated by the POSIX standard: `-b' `--characters-as-bytes' Cause `gawk' to treat all input data as single-byte characters. - In addition, all output written with `print' or `printf' are + In addition, all output written with `print' or `printf' is treated as single-byte characters. Normally, `gawk' follows the POSIX standard and attempts to process @@ -2482,7 +2483,7 @@ The following list describes options mandated by the POSIX standard: This can often involve converting multibyte characters into wide characters (internally), and can lead to problems or confusion if the input data does not contain valid multibyte characters. This - option is an easy way to tell `gawk': "hands off my data!". + option is an easy way to tell `gawk', "Hands off my data!" `-c' `--traditional' @@ -2517,7 +2518,7 @@ The following list describes options mandated by the POSIX standard: default, the debugger reads commands interactively from the keyboard (standard input). The optional FILE argument allows you to specify a file with a list of commands for the debugger to - execute non-interactively. No space is allowed between the `-D' + execute noninteractively. No space is allowed between the `-D' and FILE, if FILE is supplied. `-e' PROGRAM-TEXT @@ -2552,23 +2553,23 @@ The following list describes options mandated by the POSIX standard: `-g' `--gen-pot' - Analyze the source program and generate a GNU `gettext' Portable - Object Template file on standard output for all string constants + Analyze the source program and generate a GNU `gettext' portable + object template file on standard output for all string constants that have been marked for translation. *Note Internationalization::, for information about this option. `-h' `--help' - Print a "usage" message summarizing the short and long style + Print a "usage" message summarizing the short- and long-style options that `gawk' accepts and then exit. `-i' SOURCE-FILE `--include' SOURCE-FILE Read an `awk' source library from SOURCE-FILE. This option is completely equivalent to using the `@include' directive inside - your program. This option is very similar to the `-f' option, but - there are two important differences. First, when `-i' is used, - the program source is not loaded if it has been previously loaded, + your program. It is very similar to the `-f' option, but there + are two important differences. First, when `-i' is used, the + program source is not loaded if it has been previously loaded, whereas with `-f', `gawk' always loads the file. Second, because this option is intended to be used with code libraries, `gawk' does not recognize such files as constituting main program input. @@ -2630,7 +2631,7 @@ The following list describes options mandated by the POSIX standard: `-o'[FILE] `--pretty-print'[`='FILE] - Enable pretty-printing of `awk' programs. By default, output + Enable pretty-printing of `awk' programs. By default, the output program is created in a file named `awkprof.out' (*note Profiling::). The optional FILE argument allows you to specify a different file name for the output. No space is allowed between @@ -2736,7 +2737,7 @@ 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 `-e' -option. This does not require you to pre-empt the standard input for +option. This does not require you to preempt 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. @@ -2895,7 +2896,7 @@ implementations, you must supply a precise pathname for each program file, unless the file is in the current directory. But with `gawk', if the file name supplied to the `-f' or `-i' options does not contain a directory separator `/', then `gawk' searches a list of directories -(called the "search path"), one by one, looking for a file with the +(called the "search path") one by one, looking for a file with the specified name. The search path is a string consisting of directory names separated by @@ -2928,9 +2929,9 @@ or by placing two colons next to each other [`::'].) Different past versions of `gawk' would also look explicitly in the current directory, either before or after the path search. As - of version 4.1.2, this no longer happens, and if you wish to look - in the current directory, you must include `.' either as a separate - entry, or as a null entry in the search path. + of version 4.1.2, this no longer happens; if you wish to look in + the current directory, you must include `.' either as a separate + entry or as a null entry in the search path. The default value for `AWKPATH' is `.:/usr/local/share/awk'.(2) Since `.' is included at the beginning, `gawk' searches first in the @@ -3042,7 +3043,7 @@ change. The variables are: If this variable exists, `gawk' includes the file name and line number within the `gawk' source code from which warning and/or fatal messages are generated. Its purpose is to help isolate the - source of a message, as there are multiple places which produce the + source of a message, as there are multiple places that produce the same warning or error message. `GAWK_NO_DFA' @@ -3058,16 +3059,16 @@ change. The variables are: evaluation stack, when needed. `INT_CHAIN_MAX' - The intended maximum number of items `gawk' will maintain on a - hash chain for managing arrays indexed by integers. + This specifies intended maximum number of items `gawk' will + maintain on a hash chain for managing arrays indexed by integers. `STR_CHAIN_MAX' - The intended maximum number of items `gawk' will maintain on a - hash chain for managing arrays indexed by strings. + This specifies intended maximum number of items `gawk' will + maintain on a hash chain for managing arrays indexed by strings. `TIDYMEM' If this variable exists, `gawk' uses the `mtrace()' library calls - from GNU LIBC to help track down possible memory leaks. + from the GNU C library to help track down possible memory leaks. File: gawk.info, Node: Exit Status, Next: Include Files, Prev: Environment Variables, Up: Invoking Gawk @@ -3099,11 +3100,11 @@ This minor node describes a feature that is specific to `gawk'. files. This gives you the ability to split large `awk' source files into smaller, more manageable pieces, and also lets you reuse common `awk' code from various `awk' scripts. In other words, you can group -together `awk' functions, used to carry out specific tasks, into -external files. These files can be used just like function libraries, -using the `@include' keyword in conjunction with the `AWKPATH' -environment variable. Note that source files may also be included -using the `-i' option. +together `awk' functions used to carry out specific tasks into external +files. These files can be used just like function libraries, using the +`@include' keyword in conjunction with the `AWKPATH' environment +variable. Note that source files may also be included using the `-i' +option. Let's see an example. We'll start with two (trivial) `awk' scripts, namely `test1' and `test2'. Here is the `test1' script: @@ -3165,11 +3166,11 @@ Variable::) apply to `@include' also. This is very helpful in constructing `gawk' function libraries. If you have a large script with useful, general-purpose `awk' functions, you can break it down into library files and put those files in a -special directory. You can then include those "libraries," using -either the full pathnames of the files, or by setting the `AWKPATH' +special directory. You can then include those "libraries," either by +using the full pathnames of the files, or by setting the `AWKPATH' environment variable accordingly and then using `@include' with just -the file part of the full pathname. Of course, you can have more than -one directory to keep library files; the more complex the working +the file part of the full pathname. Of course, you can keep library +files in more than one directory; the more complex the working environment is, the more directories you may need to organize the files to be included. @@ -3181,8 +3182,8 @@ particular, `@include' is very useful for writing CGI scripts to be run from web pages. As mentioned in *note AWKPATH Variable::, the current directory is -always searched first for source files, before searching in `AWKPATH', -and this also applies to files named with `@include'. +always searched first for source files, before searching in `AWKPATH'; +this also applies to files named with `@include'. File: gawk.info, Node: Loading Shared Libraries, Next: Obsolete, Prev: Include Files, Up: Invoking Gawk @@ -3227,8 +3228,8 @@ File: gawk.info, Node: Obsolete, Next: Undocumented, Prev: Loading Shared Lib ==================================== This minor node describes features and/or command-line options from -previous releases of `gawk' that are either not available in the -current version or that are still supported but deprecated (meaning that +previous releases of `gawk' that either are not available in the +current version or are still supported but deprecated (meaning that they will _not_ be in the next release). The process-related special files `/dev/pid', `/dev/ppid', @@ -3256,7 +3257,7 @@ File: gawk.info, Node: Invoking Summary, Prev: Undocumented, Up: Invoking Gaw run `awk'. * The three standard options for all versions of `awk' are `-f', - `-F' and `-v'. `gawk' supplies these and many others, as well as + `-F', and `-v'. `gawk' supplies these and many others, as well as corresponding GNU-style long options. * Nonoption command-line arguments are usually treated as file names, @@ -3286,7 +3287,7 @@ File: gawk.info, Node: Invoking Summary, Prev: Undocumented, Up: Invoking Gaw * `gawk' allows you to load additional functions written in C or C++ using the `@load' statement and/or the `-l' option. (This - advanced feature is described later on in *note Dynamic + advanced feature is described later, in *note Dynamic Extensions::.) @@ -3435,7 +3436,7 @@ sequences apply to both string constants and regexp constants: Horizontal TAB, `Ctrl-i', ASCII code 9 (HT). `\v' - Vertical tab, `Ctrl-k', ASCII code 11 (VT). + Vertical TAB, `Ctrl-k', ASCII code 11 (VT). `\NNN' The octal value NNN, where NNN stands for 1 to 3 digits between @@ -3485,7 +3486,7 @@ normally be a regexp operator. For example, `/a\+b/' matches the three characters `a+b'. For complete portability, do not use a backslash before any -character not shown in the previous list and that is not an operator. +character not shown in the previous list or that is not an operator. Backslash Before Regular Characters @@ -3547,7 +3548,7 @@ and converted into corresponding real characters as the very first step in processing regexps. Here is a list of metacharacters. All characters that are not escape -sequences and that are not listed in the following stand for themselves: +sequences and that are not listed here stand for themselves: `\' This suppresses the special meaning of a character when matching. @@ -3630,7 +3631,7 @@ sequences and that are not listed in the following stand for themselves: There are two subtle points to understand about how `*' works. First, the `*' applies only to the single preceding regular expression component (e.g., in `ph*', it applies just to the `h'). - To cause `*' to apply to a larger sub-expression, use parentheses: + To cause `*' to apply to a larger subexpression, use parentheses: `(ph)*' matches `ph', `phph', `phphph', and so on. Second, `*' finds as many repetitions as possible. If the text to @@ -3661,10 +3662,10 @@ sequences and that are not listed in the following stand for themselves: Matches `whhhy', but not `why' or `whhhhy'. `wh{3,5}y' - Matches `whhhy', `whhhhy', or `whhhhhy', only. + Matches `whhhy', `whhhhy', or `whhhhhy' only. `wh{2,}y' - Matches `whhy' or `whhhy', and so on. + Matches `whhy', `whhhy', and so on. Interval expressions were not traditionally available in `awk'. They were added as part of the POSIX standard to make `awk' and @@ -3766,7 +3767,7 @@ Class Meaning `[:print:]' Printable characters (characters that are not control characters) `[:punct:]' Punctuation characters (characters that are not letters, - digits control characters, or space characters) + digits, control characters, or space characters) `[:space:]' Space characters (such as space, TAB, and formfeed, to name a few) `[:upper:]' Uppercase alphabetic characters @@ -3804,8 +3805,9 @@ Collating symbols Equivalence classes Locale-specific names for a list of characters that are equal. The name is enclosed between `[=' and `=]'. For example, the name `e' - might be used to represent all of "e," "e`," and "e'." In this - case, `[[=e=]]' is a regexp that matches any of `e', `e'', or `e`'. + might be used to represent all of "e," "e^," "e`," and "e'." In + this case, `[[=e=]]' is a regexp that matches any of `e', `e^', + `e'', or `e`'. These features are very valuable in non-English-speaking locales. @@ -3827,7 +3829,7 @@ Consider the following: This example uses the `sub()' function to make a change to the input record. (`sub()' replaces the first instance of any text matched by the first argument with the string provided as the second argument; -*note String Functions::). Here, the regexp `/a+/' indicates "one or +*note String Functions::.) Here, the regexp `/a+/' indicates "one or more `a' characters," and the replacement text is `<A>'. The input contains four `a' characters. `awk' (and POSIX) regular @@ -3864,15 +3866,16 @@ regexp": This sets `digits_regexp' to a regexp that describes one or more digits, and tests whether the input record matches this regexp. - NOTE: When using the `~' and `!~' operators, there is a difference - between a regexp constant enclosed in slashes and a string - constant enclosed in double quotes. If you are going to use a - string constant, you have to understand that the string is, in - essence, scanned _twice_: the first time when `awk' reads your + NOTE: When using the `~' and `!~' operators, be aware that there + is a difference between a regexp constant enclosed in slashes and + a string constant enclosed in double quotes. If you are going to + use a string constant, you have to understand that the string is, + in essence, scanned _twice_: the first time when `awk' reads your program, and the second time when it goes to match the string on the lefthand side of the operator with the pattern on the right. This is true of any string-valued expression (such as - `digits_regexp', shown previously), not just string constants. + `digits_regexp', shown in the previous example), not just string + constants. What difference does it make if the string is scanned twice? The answer has to do with escape sequences, and particularly with @@ -3969,7 +3972,7 @@ letters, digits, or underscores (`_'): `\B' Matches the empty string that occurs between two word-constituent - characters. For example, `/\Brat\B/' matches `crate' but it does + characters. For example, `/\Brat\B/' matches `crate', but it does not match `dirty rat'. `\B' is essentially the opposite of `\y'. There are two other operators that work on buffers. In Emacs, a @@ -3978,10 +3981,10 @@ letters, digits, or underscores (`_'): operators are: `\`' - Matches the empty string at the beginning of a buffer (string). + Matches the empty string at the beginning of a buffer (string) `\'' - Matches the empty string at the end of a buffer (string). + Matches the empty string at the end of a buffer (string) Because `^' and `$' always work in terms of the beginning and end of strings, these operators don't add any new capabilities for `awk'. @@ -4152,7 +4155,7 @@ one line. Each record is automatically split into chunks called parts of a record. On rare occasions, you may need to use the `getline' command. The -`getline' command is valuable, both because it can do explicit input +`getline' command is valuable both because it can do explicit input from any number of files, and because the files used with it do not have to be named on the `awk' command line (*note Getline::). @@ -4202,8 +4205,8 @@ File: gawk.info, Node: awk split records, Next: gawk split records, Up: Recor Records are separated by a character called the "record separator". By default, the record separator is the newline character. This is why -records are, by default, single lines. A different character can be -used for the record separator by assigning the character to the +records are, by default, single lines. To use a different character +for the record separator, simply assign that character to the predefined variable `RS'. Like any other variable, the value of `RS' can be changed in the @@ -4218,14 +4221,14 @@ BEGIN/END::). For example: awk 'BEGIN { RS = "u" } { print $0 }' mail-list -changes the value of `RS' to `u', before reading any input. This is a -string whose first character is the letter "u"; as a result, records -are separated by the letter "u." Then the input file is read, and the -second rule in the `awk' program (the action with no pattern) prints -each record. Because each `print' statement adds a newline at the end -of its output, this `awk' program copies the input with each `u' -changed to a newline. Here are the results of running the program on -`mail-list': +changes the value of `RS' to `u', before reading any input. The new +value is a string whose first character is the letter "u"; as a result, +records are separated by the letter "u". Then the input file is read, +and the second rule in the `awk' program (the action with no pattern) +prints each record. Because each `print' statement adds a newline at +the end of its output, this `awk' program copies the input with each +`u' changed to a newline. Here are the results of running the program +on `mail-list': $ awk 'BEGIN { RS = "u" } > { print $0 }' mail-list @@ -4273,11 +4276,11 @@ data file (*note Sample Data Files::), the line looks like this: Bill 555-1675 bill.drowning@hotmail.com A -It contains no `u' so there is no reason to split the record, unlike -the others which have one or more occurrences of the `u'. In fact, -this record is treated as part of the previous record; the newline -separating them in the output is the original newline in the data file, -not the one added by `awk' when it printed the record! +It contains no `u', so there is no reason to split the record, unlike +the others, which each have one or more occurrences of the `u'. In +fact, this record is treated as part of the previous record; the +newline separating them in the output is the original newline in the +data file, not the one added by `awk' when it printed the record! Another way to change the record separator is on the command line, using the variable-assignment feature (*note Other Arguments::): @@ -4343,8 +4346,8 @@ part of either record. character. However, when `RS' is a regular expression, `RT' contains the actual input text that matched the regular expression. - If the input file ended without any text that matches `RS', `gawk' -sets `RT' to the null string. + If the input file ends without any text matching `RS', `gawk' sets +`RT' to the null string. The following example illustrates both of these features. It sets `RS' equal to a regular expression that matches either a newline or a @@ -4442,12 +4445,12 @@ to these pieces of the record. You don't have to use them--you can operate on the whole record if you want--but fields are what make simple `awk' programs so powerful. - You use a dollar-sign (`$') to refer to a field in an `awk' program, + You use a dollar sign (`$') to refer to a field in an `awk' program, followed by the number of the field you want. Thus, `$1' refers to the -first field, `$2' to the second, and so on. (Unlike the Unix shells, -the field numbers are not limited to single digits. `$127' is the -127th field in the record.) For example, suppose the following is a -line of input: +first field, `$2' to the second, and so on. (Unlike in the Unix +shells, the field numbers are not limited to single digits. `$127' is +the 127th field in the record.) For example, suppose the following is +a line of input: This seems like a pretty nice example. @@ -4464,10 +4467,9 @@ as `$7', which is `example.'. If you try to reference a field beyond the last one (such as `$8' when the record has only seven fields), you get the empty string. (If used in a numeric operation, you get zero.) - The use of `$0', which looks like a reference to the "zero-th" -field, is a special case: it represents the whole input record. Use it -when you are not interested in specific fields. Here are some more -examples: + The use of `$0', which looks like a reference to the "zeroth" field, +is a special case: it represents the whole input record. Use it when +you are not interested in specific fields. Here are some more examples: $ awk '$1 ~ /li/ { print $0 }' mail-list -| Amelia 555-5553 amelia.zodiacusque@gmail.com F @@ -4515,8 +4517,8 @@ is another example of using expressions as field numbers: awk '{ print $(2*2) }' mail-list `awk' evaluates the expression `(2*2)' and uses its value as the -number of the field to print. The `*' sign represents multiplication, -so the expression `2*2' evaluates to four. The parentheses are used so +number of the field to print. The `*' represents multiplication, so +the expression `2*2' evaluates to four. The parentheses are used so that the multiplication is done before the `$' operation; they are necessary whenever there is a binary operator(1) in the field-number expression. This example, then, prints the type of relationship (the @@ -4540,7 +4542,7 @@ field number. ---------- Footnotes ---------- (1) A "binary operator", such as `*' for multiplication, is one that -takes two operands. The distinction is required, because `awk' also has +takes two operands. The distinction is required because `awk' also has unary (one-operand) and ternary (three-operand) operators. @@ -4662,7 +4664,7 @@ value of `NF' and recomputes `$0'. (d.c.) Here is an example: decremented. Finally, there are times when it is convenient to force `awk' to -rebuild the entire record, using the current value of the fields and +rebuild the entire record, using the current values of the fields and `OFS'. To do this, use the seemingly innocuous assignment: $1 = $1 # force record to be reconstituted @@ -4682,7 +4684,7 @@ built-in function that updates `$0', such as `sub()' and `gsub()' It is important to remember that `$0' is the _full_ record, exactly as it was read from the input. This includes any leading or trailing whitespace, and the exact whitespace (or other characters) that -separate the fields. +separates the fields. It is a common error to try to change the field separators in a record simply by setting `FS' and `OFS', and then expecting a plain @@ -4750,7 +4752,7 @@ attached, such as: John Q. Smith, LXIX, 29 Oak St., Walamazoo, MI 42139 -The same program would extract `*LXIX', instead of `*29*Oak*St.'. If +The same program would extract `*LXIX' instead of `*29*Oak*St.'. If you were expecting the program to print the address, you would be surprised. The moral is to choose your data layout and separator characters carefully to prevent such problems. (If the data is not in @@ -4949,11 +4951,11 @@ your field and record separators. Perhaps the most common use of a single character as the field separator occurs when processing the Unix system password file. On many Unix systems, each user has a separate entry in the system -password file, one line per user. The information in these lines is -separated by colons. The first field is the user's login name and the -second is the user's encrypted or shadow password. (A shadow password -is indicated by the presence of a single `x' in the second field.) A -password file entry might look like this: +password file, with one line per user. The information in these lines +is separated by colons. The first field is the user's login name and +the second is the user's encrypted or shadow password. (A shadow +password is indicated by the presence of a single `x' in the second +field.) A password file entry might look like this: arnold:x:2076:10:Arnold Robbins:/home/arnold:/bin/bash @@ -4981,15 +4983,14 @@ When you do this, `$1' is the same as `$0'. According to the POSIX standard, `awk' is supposed to behave as if each record is split into fields at the time it is read. In particular, this means that if you change the value of `FS' after a -record is read, the value of the fields (i.e., how they were split) +record is read, the values of the fields (i.e., how they were split) should reflect the old value of `FS', not the new one. However, many older implementations of `awk' do not work this way. Instead, they defer splitting the fields until a field is actually referenced. The fields are split using the _current_ value of `FS'! (d.c.) This behavior can be difficult to diagnose. The following -example illustrates the difference between the two methods. (The -`sed'(2) command prints just the first line of `/etc/passwd'.) +example illustrates the difference between the two methods: sed 1q /etc/passwd | awk '{ FS = ":" ; print $1 }' @@ -5002,6 +5003,8 @@ first line of the file, something like: root:x:0:0:Root:/: + (The `sed'(2) command prints just the first line of `/etc/passwd'.) + ---------- Footnotes ---------- (1) Thanks to Andrew Schorr for this tip. @@ -5155,7 +5158,7 @@ run on a system with card readers is another story!) splitting again. Use `FS = FS' to make this happen, without having to know the current value of `FS'. In order to tell which kind of field splitting is in effect, use `PROCINFO["FS"]' (*note Auto-set::). The -value is `"FS"' if regular field splitting is being used, or it is +value is `"FS"' if regular field splitting is being used, or `"FIELDWIDTHS"' if fixed-width field splitting is being used: if (PROCINFO["FS"] == "FS") @@ -5188,10 +5191,10 @@ what they are, and not by what they are not. The most notorious such case is so-called "comma-separated values" (CSV) data. Many spreadsheet programs, for example, can export their data into text files, where each record is terminated with a newline, -and fields are separated by commas. If only commas separated the data, +and fields are separated by commas. If commas only separated the data, there wouldn't be an issue. The problem comes when one of the fields contains an _embedded_ comma. In such cases, most programs embed the -field in double quotes.(1) So we might have data like this: +field in double quotes.(1) So, we might have data like this: Robbins,Arnold,"1234 A Pretty Street, NE",MyTown,MyState,12345-6789,USA @@ -5258,9 +5261,9 @@ being used. provides an elegant solution for the majority of cases, and the `gawk' developers are satisfied with that. - As written, the regexp used for `FPAT' requires that each field have -a least one character. A straightforward modification (changing -changed the first `+' to `*') allows fields to be empty: + As written, the regexp used for `FPAT' requires that each field +contain at least one character. A straightforward modification +(changing the first `+' to `*') allows fields to be empty: FPAT = "([^,]*)|(\"[^\"]+\")" @@ -5268,9 +5271,8 @@ changed the first `+' to `*') allows fields to be empty: available for splitting regular strings (*note String Functions::). To recap, `gawk' provides three independent methods to split input -records into fields. `gawk' uses whichever mechanism was last chosen -based on which of the three variables--`FS', `FIELDWIDTHS', and -`FPAT'--was last assigned to. +records into fields. The mechanism used is based on which of the three +variables--`FS', `FIELDWIDTHS', or `FPAT'--was last assigned to. ---------- Footnotes ---------- @@ -5308,7 +5310,7 @@ empty; lines that contain only whitespace do not count.) `"\n\n+"' to `RS'. This regexp matches the newline at the end of the record and one or more blank lines after the record. In addition, a regular expression always matches the longest possible sequence when -there is a choice (*note Leftmost Longest::). So the next record +there is a choice (*note Leftmost Longest::). So, the next record doesn't start until the first nonblank line that follows--no matter how many blank lines appear in a row, they are considered one record separator. @@ -5320,12 +5322,12 @@ last record, the final newline is removed from the record. In the second case, this special processing is not done. (d.c.) Now that the input is separated into records, the second step is to -separate the fields in the record. One way to do this is to divide each -of the lines into fields in the normal manner. This happens by default -as the result of a special feature. When `RS' is set to the empty -string, _and_ `FS' is set to a single character, the newline character -_always_ acts as a field separator. This is in addition to whatever -field separations result from `FS'.(1) +separate the fields in the records. One way to do this is to divide +each of the lines into fields in the normal manner. This happens by +default as the result of a special feature. When `RS' is set to the +empty string _and_ `FS' is set to a single character, the newline +character _always_ acts as a field separator. This is in addition to +whatever field separations result from `FS'.(1) The original motivation for this special exception was probably to provide useful behavior in the default case (i.e., `FS' is equal to @@ -5333,17 +5335,17 @@ provide useful behavior in the default case (i.e., `FS' is equal to newline character to separate fields, because there is no way to prevent it. However, you can work around this by using the `split()' function to break up the record manually (*note String Functions::). -If you have a single character field separator, you can work around the +If you have a single-character field separator, you can work around the special feature in a different way, by making `FS' into a regexp for that single character. For example, if the field separator is a percent character, instead of `FS = "%"', use `FS = "[%]"'. Another way to separate fields is to put each field on a separate line: to do this, just set the variable `FS' to the string `"\n"'. -(This single character separator matches a single newline.) A +(This single-character separator matches a single newline.) A practical example of a data file organized this way might be a mailing -list, where each entry is separated by blank lines. Consider a mailing -list in a file named `addresses', which looks like this: +list, where blank lines separate the entries. Consider a mailing list +in a file named `addresses', which looks like this: Jane Doe 123 Main Street @@ -5426,7 +5428,7 @@ File: gawk.info, Node: Getline, Next: Read Timeout, Prev: Multiple Line, Up: So far we have been getting our input data from `awk''s main input stream--either the standard input (usually your keyboard, sometimes the -output from another program) or from the files specified on the command +output from another program) or the files specified on the command line. The `awk' language has a special built-in command called `getline' that can be used to read input under your explicit control. @@ -5568,7 +5570,7 @@ and produces these results: free The `getline' command used in this way sets only the variables `NR', -`FNR', and `RT' (and of course, VAR). The record is not split into +`FNR', and `RT' (and, of course, VAR). The record is not split into fields, so the values of the fields (including `$0') and the value of `NF' do not change. @@ -5578,8 +5580,8 @@ File: gawk.info, Node: Getline/File, Next: Getline/Variable/File, Prev: Getli 4.9.3 Using `getline' from a File --------------------------------- -Use `getline < FILE' to read the next record from FILE. Here FILE is a -string-valued expression that specifies the file name. `< FILE' is +Use `getline < FILE' to read the next record from FILE. Here, FILE is +a string-valued expression that specifies the file name. `< FILE' is called a "redirection" because it directs input to come from a different place. For example, the following program reads its input record from the file `secondary.input' when it encounters a first field @@ -5715,8 +5717,8 @@ all `awk' implementations. treatment of a construct like `"echo " "date" | getline'. Most versions, including the current version, treat it at as `("echo " "date") | getline'. (This is also how BWK `awk' behaves.) Some - versions changed and treated it as `"echo " ("date" | getline)'. - (This is how `mawk' behaves.) In short, _always_ use explicit + versions instead treat it as `"echo " ("date" | getline)'. (This + is how `mawk' behaves.) In short, _always_ use explicit parentheses, and then you won't have to worry. @@ -5752,15 +5754,16 @@ File: gawk.info, Node: Getline/Coprocess, Next: Getline/Variable/Coprocess, P 4.9.7 Using `getline' from a Coprocess -------------------------------------- -Input into `getline' from a pipe is a one-way operation. The command -that is started with `COMMAND | getline' only sends data _to_ your -`awk' program. +Reading input into `getline' from a pipe is a one-way operation. The +command that is started with `COMMAND | getline' only sends data _to_ +your `awk' program. On occasion, you might want to send data to another program for processing and then read the results back. `gawk' allows you to start a "coprocess", with which two-way communications are possible. This is done with the `|&' operator. Typically, you write data to the -coprocess first and then read results back, as shown in the following: +coprocess first and then read the results back, as shown in the +following: print "SOME QUERY" |& "db_server" "db_server" |& getline @@ -5822,7 +5825,7 @@ in mind: files. (d.c.) (See *note BEGIN/END::; also *note Auto-set::.) * Using `FILENAME' with `getline' (`getline < FILENAME') is likely - to be a source for confusion. `awk' opens a separate input stream + to be a source of confusion. `awk' opens a separate input stream from the current input file. However, by not using a variable, `$0' and `NF' are still updated. If you're doing this, it's probably by accident, and you should reconsider what it is you're @@ -5830,15 +5833,15 @@ in mind: * *note Getline Summary::, presents a table summarizing the `getline' variants and which variables they can affect. It is - worth noting that those variants which do not use redirection can + worth noting that those variants that do not use redirection can cause `FILENAME' to be updated if they cause `awk' to start reading a new input file. * If the variable being assigned is an expression with side effects, different versions of `awk' behave differently upon encountering end-of-file. Some versions don't evaluate the expression; many - versions (including `gawk') do. Here is an example, due to Duncan - Moore: + versions (including `gawk') do. Here is an example, courtesy of + Duncan Moore: BEGIN { system("echo 1 > f") @@ -5846,8 +5849,8 @@ in mind: print c } - Here, the side effect is the `++c'. Is `c' incremented if end of - file is encountered, before the element in `a' is assigned? + Here, the side effect is the `++c'. Is `c' incremented if + end-of-file is encountered before the element in `a' is assigned? `gawk' treats `getline' like a function call, and evaluates the expression `a[++c]' before attempting to read from `f'. However, @@ -5891,8 +5894,8 @@ This minor node describes a feature that is specific to `gawk'. You may specify a timeout in milliseconds for reading input from the keyboard, a pipe, or two-way communication, including TCP/IP sockets. -This can be done on a per input, command, or connection basis, by -setting a special element in the `PROCINFO' array (*note Auto-set::): +This can be done on a per-input, per-command, or per-connection basis, +by setting a special element in the `PROCINFO' array (*note Auto-set::): PROCINFO["input_name", "READ_TIMEOUT"] = TIMEOUT IN MILLISECONDS @@ -5916,7 +5919,7 @@ for more than five seconds: print $0 `gawk' terminates the read operation if input does not arrive after -waiting for the timeout period, returns failure and sets `ERRNO' to an +waiting for the timeout period, returns failure, and sets `ERRNO' to an appropriate string value. A negative or zero value for the timeout is the same as specifying no timeout at all. @@ -5956,7 +5959,7 @@ input to arrive: environment variable exists, `gawk' uses its value to initialize the timeout value. The exclusive use of the environment variable to specify timeout has the disadvantage of not being able to control it on -a per command or connection basis. +a per-command or per-connection basis. `gawk' considers a timeout event to be an error even though the attempt to read from the underlying device may succeed in a later @@ -6052,7 +6055,7 @@ File: gawk.info, Node: Input Summary, Next: Input Exercises, Prev: Command-li * `gawk' sets `RT' to the text matched by `RS'. * After splitting the input into records, `awk' further splits the - record into individual fields, named `$1', `$2', and so on. `$0' + records into individual fields, named `$1', `$2', and so on. `$0' is the whole record, and `NF' indicates how many fields there are. The default way to split fields is between whitespace characters. @@ -6066,19 +6069,21 @@ File: gawk.info, Node: Input Summary, Next: Input Exercises, Prev: Command-li * Field splitting is more complicated than record splitting: - Field separator value Fields are split ... `awk' / - `gawk' + Field separator value Fields are split ... `awk' / + `gawk' ---------------------------------------------------------------------- - `FS == " "' On runs of whitespace `awk' - `FS == ANY SINGLE On that character `awk' - CHARACTER' - `FS == REGEXP' On text matching the regexp `awk' - `FS == ""' Each individual character is `gawk' - a separate field - `FIELDWIDTHS == LIST OF Based on character position `gawk' - COLUMNS' - `FPAT == REGEXP' On the text surrounding text `gawk' - matching the regexp + `FS == " "' On runs of whitespace `awk' + `FS == ANY SINGLE On that character `awk' + CHARACTER' + `FS == REGEXP' On text matching the `awk' + regexp + `FS == ""' Such that each individual `gawk' + character is a separate + field + `FIELDWIDTHS == LIST OF Based on character `gawk' + COLUMNS' position + `FPAT == REGEXP' On the text surrounding `gawk' + text matching the regexp * Using `FS = "\n"' causes the entire record to be a single field (assuming that newlines separate records). @@ -6088,12 +6093,11 @@ File: gawk.info, Node: Input Summary, Next: Input Exercises, Prev: Command-li * Use `PROCINFO["FS"]' to see how fields are being split. - * Use `getline' in its various forms to read additional records, - from the default input stream, from a file, or from a pipe or - coprocess. + * Use `getline' in its various forms to read additional records from + the default input stream, from a file, or from a pipe or coprocess. - * Use `PROCINFO[FILE, "READ_TIMEOUT"]' to cause reads to timeout for - FILE. + * Use `PROCINFO[FILE, "READ_TIMEOUT"]' to cause reads to time out + for FILE. * Directories on the command line are fatal for standard `awk'; `gawk' ignores them if not in POSIX mode. @@ -6187,7 +6191,7 @@ you will probably get an error. Keep in mind that a space is printed between any two items. Note that the `print' statement is a statement and not an -expression--you can't use it in the pattern part of a PATTERN-ACTION +expression--you can't use it in the pattern part of a pattern-action statement, for example. @@ -6335,7 +6339,7 @@ File: gawk.info, Node: OFMT, Next: Printf, Prev: Output Separators, Up: Prin =========================================== When printing numeric values with the `print' statement, `awk' -internally converts the number to a string of characters and prints +internally converts each number to a string of characters and prints that string. `awk' uses the `sprintf()' function to do this conversion (*note String Functions::). For now, it suffices to say that the `sprintf()' function accepts a "format specification" that tells it how @@ -6390,7 +6394,7 @@ A simple `printf' statement looks like this: As for `print', the entire list of arguments may optionally be enclosed in parentheses. Here too, the parentheses are necessary if any of the -item expressions use the `>' relational operator; otherwise, it can be +item expressions uses the `>' relational operator; otherwise, it can be confused with an output redirection (*note Redirection::). The difference between `printf' and `print' is the FORMAT argument. @@ -6417,7 +6421,7 @@ statements. For example: > }' -| Don't Panic! -Here, neither the `+' nor the `OUCH!' appear in the output message. +Here, neither the `+' nor the `OUCH!' appears in the output message. File: gawk.info, Node: Control Letters, Next: Format Modifiers, Prev: Basic Printf, Up: Printf @@ -6456,7 +6460,7 @@ width. Here is a list of the format-control letters: (The `%i' specification is for compatibility with ISO C.) `%e', `%E' - Print a number in scientific (exponential) notation; for example: + Print a number in scientific (exponential) notation. For example: printf "%4.3e\n", 1950 @@ -6481,7 +6485,7 @@ width. Here is a list of the format-control letters: Math Definitions::). `%F' - Like `%f' but the infinity and "not a number" values are spelled + Like `%f', but the infinity and "not a number" values are spelled using uppercase letters. The `%F' format is a POSIX extension to ISO C; not all systems @@ -6675,7 +6679,7 @@ string, like so: s = "abcdefg" printf "%" w "." p "s\n", s -This is not particularly easy to read but it does work. +This is not particularly easy to read, but it does work. C programmers may be used to supplying additional modifiers (`h', `j', `l', `L', `t', and `z') in `printf' format strings. These are not @@ -6714,7 +6718,7 @@ an aligned two-column table of names and phone numbers, as shown here: -| Jean-Paul 555-2127 In this case, the phone numbers had to be printed as strings because -the numbers are separated by a dash. Printing the phone numbers as +the numbers are separated by dashes. Printing the phone numbers as numbers would have produced just the first three digits: `555'. This would have been pretty confusing. @@ -6762,7 +6766,7 @@ output, usually the screen. Both `print' and `printf' can also send their output to other places. This is called "redirection". NOTE: When `--sandbox' is specified (*note Options::), redirecting - output to files, pipes and coprocesses is disabled. + output to files, pipes, and coprocesses is disabled. A redirection appears after the `print' or `printf' statement. Redirections in `awk' are written just like redirections in shell @@ -6802,7 +6806,7 @@ work identically for `printf': Each output file contains one name or number per line. `print ITEMS >> OUTPUT-FILE' - This redirection prints the items into the pre-existing output file + This redirection prints the items into the preexisting output file named OUTPUT-FILE. The difference between this and the single-`>' redirection is that the old contents (if any) of OUTPUT-FILE are not erased. Instead, the `awk' output is appended to the file. @@ -6850,8 +6854,8 @@ work identically for `printf': `print ITEMS |& COMMAND' This redirection prints the items to the input of COMMAND. The difference between this and the single-`|' redirection is that the - output from COMMAND can be read with `getline'. Thus COMMAND is a - "coprocess", which works together with, but subsidiary to, the + output from COMMAND can be read with `getline'. Thus, COMMAND is + a "coprocess", which works together with but is subsidiary to the `awk' program. This feature is a `gawk' extension, and is not available in POSIX @@ -6875,7 +6879,7 @@ a file, and then to use `>>' for subsequent output: This is indeed how redirections must be used from the shell. But in `awk', it isn't necessary. In this kind of case, a program should use `>' for all the `print' statements, because the output file is only -opened once. (It happens that if you mix `>' and `>>' that output is +opened once. (It happens that if you mix `>' and `>>' output is produced in the expected order. However, mixing the operators for the same file is definitely poor style, and is confusing to readers of your program.) @@ -6908,14 +6912,14 @@ command lines to be fed to the shell. File: gawk.info, Node: Special FD, Next: Special Files, Prev: Redirection, Up: Printing -5.7 Special Files for Standard Pre-Opened Data Streams -====================================================== +5.7 Special Files for Standard Preopened Data Streams +===================================================== Running programs conventionally have three input and output streams already available to them for reading and writing. These are known as the "standard input", "standard output", and "standard error output". -These open streams (and any other open file or pipe) are often referred -to by the technical term "file descriptors". +These open streams (and any other open files or pipes) are often +referred to by the technical term "file descriptors". These streams are, by default, connected to your keyboard and screen, but they are often redirected with the shell, via the `<', `<<', @@ -6940,7 +6944,7 @@ error messages to the screen, like this: (`/dev/tty' is a special file supplied by the operating system that is connected to your keyboard and screen. It represents the "terminal,"(1) which on modern systems is a keyboard and screen, not a serial console.) -This generally has the same effect but not always: although the +This generally has the same effect, but not always: although the standard error stream is usually the screen, it can be redirected; when that happens, writing to the screen is not correct. In fact, if `awk' is run from a background job, it may not have a terminal at all. Then @@ -6967,7 +6971,7 @@ becomes: print "Serious error detected!" > "/dev/stderr" - Note the use of quotes around the file name. Like any other + Note the use of quotes around the file name. Like with any other redirection, the value must be a string. It is a common error to omit the quotes, which leads to confusing results. @@ -7000,7 +7004,7 @@ there are special file names reserved for TCP/IP networking. File: gawk.info, Node: Other Inherited Files, Next: Special Network, Up: Special Files -5.8.1 Accessing Other Open Files With `gawk' +5.8.1 Accessing Other Open Files with `gawk' -------------------------------------------- Besides the `/dev/stdin', `/dev/stdout', and `/dev/stderr' special file @@ -7050,7 +7054,7 @@ File: gawk.info, Node: Special Caveats, Prev: Special Network, Up: Special Fi Here are some things to bear in mind when using the special file names that `gawk' provides: - * Recognition of the file names for the three standard pre-opened + * Recognition of the file names for the three standard preopened files is disabled only in POSIX mode. * Recognition of the other special file names is disabled if `gawk' @@ -7059,7 +7063,7 @@ that `gawk' provides: * `gawk' _always_ interprets these special file names. For example, using `/dev/fd/4' for output actually writes on file descriptor 4, - and not on a new file descriptor that is `dup()''ed from file + and not on a new file descriptor that is `dup()'ed from file descriptor 4. Most of the time this does not matter; however, it is important to _not_ close any of the files related to file descriptors 0, 1, and 2. Doing so results in unpredictable @@ -7219,8 +7223,8 @@ closing input or output files, respectively. This value is zero if the close succeeds, or -1 if it fails. The POSIX standard is very vague; it says that `close()' returns -zero on success and nonzero otherwise. In general, different -implementations vary in what they report when closing pipes; thus the +zero on success and a nonzero value otherwise. In general, different +implementations vary in what they report when closing pipes; thus, the return value cannot be used portably. (d.c.) In POSIX mode (*note Options::), `gawk' just returns zero when closing a pipe. @@ -7246,8 +7250,8 @@ File: gawk.info, Node: Output Summary, Next: Output Exercises, Prev: Close Fi numeric values for the `print' statement. * The `printf' statement provides finer-grained control over output, - with format control letters for different data types and various - flags that modify the behavior of the format control letters. + with format-control letters for different data types and various + flags that modify the behavior of the format-control letters. * Output from both `print' and `printf' may be redirected to files, pipes, and coprocesses. @@ -7298,9 +7302,9 @@ value to a variable or a field by using an assignment operator. An expression can serve as a pattern or action statement on its own. Most other kinds of statements contain one or more expressions that specify the data on which to operate. As in other languages, -expressions in `awk' include variables, array references, constants, -and function calls, as well as combinations of these with various -operators. +expressions in `awk' can include variables, array references, +constants, and function calls, as well as combinations of these with +various operators. * Menu: @@ -7319,8 +7323,8 @@ File: gawk.info, Node: Values, Next: All Operators, Up: Expressions ========================================= Expressions are built up from values and the operations performed upon -them. This minor node describes the elementary objects which provide -the values used in expressions. +them. This minor node describes the elementary objects that provide the +values used in expressions. * Menu: @@ -7365,14 +7369,14 @@ the same value: 1.05e+2 1050e-1 - A string constant consists of a sequence of characters enclosed in + A "string constant" consists of a sequence of characters enclosed in double quotation marks. For example: "parrot" represents the string whose contents are `parrot'. Strings in `gawk' can be of any length, and they can contain any of the possible -eight-bit ASCII characters including ASCII NUL (character code zero). +eight-bit ASCII characters, including ASCII NUL (character code zero). Other `awk' implementations may have difficulty with some character codes. @@ -7392,14 +7396,14 @@ File: gawk.info, Node: Nondecimal-numbers, Next: Regexp Constants, Prev: Scal In `awk', all numbers are in decimal (i.e., base 10). Many other programming languages allow you to specify numbers in other bases, often octal (base 8) and hexadecimal (base 16). In octal, the numbers go 0, -1, 2, 3, 4, 5, 6, 7, 10, 11, 12, and so on. Just as `11', in decimal, -is 1 times 10 plus 1, so `11', in octal, is 1 times 8, plus 1. This -equals 9 in decimal. In hexadecimal, there are 16 digits. Because the -everyday decimal number system only has ten digits (`0'-`9'), the -letters `a' through `f' are used to represent the rest. (Case in the -letters is usually irrelevant; hexadecimal `a' and `A' have the same -value.) Thus, `11', in hexadecimal, is 1 times 16 plus 1, which equals -17 in decimal. +1, 2, 3, 4, 5, 6, 7, 10, 11, 12, and so on. Just as `11' in decimal is +1 times 10 plus 1, so `11' in octal is 1 times 8 plus 1. This equals 9 +in decimal. In hexadecimal, there are 16 digits. Because the everyday +decimal number system only has ten digits (`0'-`9'), the letters `a' +through `f' are used to represent the rest. (Case in the letters is +usually irrelevant; hexadecimal `a' and `A' have the same value.) +Thus, `11' in hexadecimal is 1 times 16 plus 1, which equals 17 in +decimal. Just by looking at plain `11', you can't tell what base it's in. So, in C, C++, and other languages derived from C, there is a special @@ -7407,13 +7411,13 @@ notation to signify the base. Octal numbers start with a leading `0', and hexadecimal numbers start with a leading `0x' or `0X': `11' - Decimal value 11. + Decimal value 11 `011' - Octal 11, decimal value 9. + Octal 11, decimal value 9 `0x11' - Hexadecimal 11, decimal value 17. + Hexadecimal 11, decimal value 17 This example shows the difference: @@ -7432,11 +7436,11 @@ really need to do this, use the `--non-decimal-data' command-line option; *note Nondecimal Data::.) If you have octal or hexadecimal data, you can use the `strtonum()' function (*note String Functions::) to convert the data into a number. Most of the time, you will want to -use octal or hexadecimal constants when working with the built-in bit -manipulation functions; see *note Bitwise Functions::, for more +use octal or hexadecimal constants when working with the built-in +bit-manipulation functions; see *note Bitwise Functions::, for more information. - Unlike some early C implementations, `8' and `9' are not valid in + Unlike in some early C implementations, `8' and `9' are not valid in octal constants. For example, `gawk' treats `018' as decimal 18: $ gawk 'BEGIN { print "021 is", 021 ; print 018 }' @@ -7463,12 +7467,12 @@ File: gawk.info, Node: Regexp Constants, Prev: Nondecimal-numbers, Up: Consta 6.1.1.3 Regular Expression Constants .................................... -A regexp constant is a regular expression description enclosed in +A "regexp constant" is a regular expression description enclosed in slashes, such as `/^beginning and end$/'. Most regexps used in `awk' programs are constant, but the `~' and `!~' matching operators can also match computed or dynamic regexps (which are typically just ordinary -strings or variables that contain a regexp, but could be a more complex -expression). +strings or variables that contain a regexp, but could be more complex +expressions). File: gawk.info, Node: Using Constant Regexps, Next: Variables, Prev: Constants, Up: Values @@ -7520,7 +7524,7 @@ and `patsplit()' functions (*note String Functions::). Modern implementations of `awk', including `gawk', allow the third argument of `split()' to be a regexp constant, but some older implementations do not. (d.c.) Because some built-in functions accept regexp constants -as arguments, it can be confusing when attempting to use regexp +as arguments, confusion can arise when attempting to use regexp constants as arguments to user-defined functions (*note User-defined::). For example: @@ -7543,10 +7547,11 @@ User-defined::). For example: In this example, the programmer wants to pass a regexp constant to the user-defined function `mysub()', which in turn passes it on to either `sub()' or `gsub()'. However, what really happens is that the -`pat' parameter is either one or zero, depending upon whether or not -`$0' matches `/hi/'. `gawk' issues a warning when it sees a regexp -constant used as a parameter to a user-defined function, because -passing a truth value in this way is probably not what was intended. +`pat' parameter is assigned a value of either one or zero, depending +upon whether or not `$0' matches `/hi/'. `gawk' issues a warning when +it sees a regexp constant used as a parameter to a user-defined +function, because passing a truth value in this way is probably not +what was intended. File: gawk.info, Node: Variables, Next: Conversion, Prev: Using Constant Regexps, Up: Values @@ -7554,7 +7559,7 @@ File: gawk.info, Node: Variables, Next: Conversion, Prev: Using Constant Rege 6.1.3 Variables --------------- -Variables are ways of storing values at one point in your program for +"Variables" are ways of storing values at one point in your program for use later in another part of your program. They can be manipulated entirely within the program text, and they can also be assigned values on the `awk' command line. @@ -7583,14 +7588,14 @@ variables. A variable name is a valid expression by itself; it represents the variable's current value. Variables are given new values with -"assignment operators", "increment operators", and "decrement -operators". *Note Assignment Ops::. In addition, the `sub()' and -`gsub()' functions can change a variable's value, and the `match()', -`split()', and `patsplit()' functions can change the contents of their -array parameters. *Note String Functions::. +"assignment operators", "increment operators", and "decrement operators" +(*note Assignment Ops::). In addition, the `sub()' and `gsub()' +functions can change a variable's value, and the `match()', `split()', +and `patsplit()' functions can change the contents of their array +parameters (*note String Functions::). A few variables have special built-in meanings, such as `FS' (the -field separator), and `NF' (the number of fields in the current input +field separator) and `NF' (the number of fields in the current input record). *Note Built-in Variables::, for a list of the predefined variables. These predefined variables can be used and assigned just like all other variables, but their values are also used or changed @@ -7787,7 +7792,7 @@ point, so the default behavior was restored to use a period as the decimal point character. You can use the `--use-lc-numeric' option (*note Options::) to force `gawk' to use the locale's decimal point character. (`gawk' also uses the locale's decimal point character when -in POSIX mode, either via `--posix', or the `POSIXLY_CORRECT' +in POSIX mode, either via `--posix' or the `POSIXLY_CORRECT' environment variable, as shown previously.) *note table-locale-affects:: describes the cases in which the @@ -7803,10 +7808,10 @@ Input Use period Use locale Table 6.1: Locale decimal point versus a period - Finally, modern day formal standards and IEEE standard floating-point -representation can have an unusual but important effect on the way -`gawk' converts some special string values to numbers. The details are -presented in *note POSIX Floating Point Problems::. + Finally, modern-day formal standards and the IEEE standard +floating-point representation can have an unusual but important effect +on the way `gawk' converts some special string values to numbers. The +details are presented in *note POSIX Floating Point Problems::. File: gawk.info, Node: All Operators, Next: Truth Values and Conditions, Prev: Values, Up: Expressions @@ -7814,7 +7819,7 @@ File: gawk.info, Node: All Operators, Next: Truth Values and Conditions, Prev 6.2 Operators: Doing Something with Values ========================================== -This minor node introduces the "operators" which make use of the values +This minor node introduces the "operators" that make use of the values provided by constants and variables. * Menu: @@ -7995,7 +8000,7 @@ you'll get. ---------- Footnotes ---------- - (1) It happens that BWK `awk', `gawk' and `mawk' all "get it right," + (1) It happens that BWK `awk', `gawk', and `mawk' all "get it right," but you should not rely on this. @@ -8112,7 +8117,7 @@ righthand expression. For example: The indices of `bar' are practically guaranteed to be different, because `rand()' returns different values each time it is called. (Arrays and the `rand()' function haven't been covered yet. *Note Arrays::, and -*note Numeric Functions::, for more information). This example +*note Numeric Functions::, for more information.) This example illustrates an important fact about assignment operators: the lefthand expression is only evaluated _once_. @@ -8130,14 +8135,14 @@ converted to a number. Operator Effect -------------------------------------------------------------------------- -LVALUE `+=' INCREMENT Add INCREMENT to the value of LVALUE -LVALUE `-=' DECREMENT Subtract DECREMENT from the value of LVALUE -LVALUE `*=' Multiply the value of LVALUE by COEFFICIENT +LVALUE `+=' INCREMENT Add INCREMENT to the value of LVALUE. +LVALUE `-=' DECREMENT Subtract DECREMENT from the value of LVALUE. +LVALUE `*=' Multiply the value of LVALUE by COEFFICIENT. COEFFICIENT -LVALUE `/=' DIVISOR Divide the value of LVALUE by DIVISOR -LVALUE `%=' MODULUS Set LVALUE to its remainder by MODULUS -LVALUE `^=' POWER -LVALUE `**=' POWER Raise LVALUE to the power POWER (c.e.) +LVALUE `/=' DIVISOR Divide the value of LVALUE by DIVISOR. +LVALUE `%=' MODULUS Set LVALUE to its remainder by MODULUS. +LVALUE `^=' POWER Raise LVALUE to the power POWER. +LVALUE `**=' POWER Raise LVALUE to the power POWER. (c.e.) Table 6.2: Arithmetic assignment operators @@ -8222,8 +8227,8 @@ is a summary of increment and decrement expressions: Operator Evaluation Order - Doctor, doctor! It hurts when I do this! - So don't do that! -- Groucho Marx + Doctor, it hurts when I do this! + Then don't do that! -- Groucho Marx What happens for something like the following? @@ -8238,7 +8243,7 @@ Or something even stranger? In other words, when do the various side effects prescribed by the postfix operators (`b++') take effect? When side effects happen is -"implementation defined". In other words, it is up to the particular +"implementation-defined". In other words, it is up to the particular version of `awk'. The result for the first example may be 12 or 13, and for the second, it may be 22 or 23. @@ -8253,7 +8258,7 @@ File: gawk.info, Node: Truth Values and Conditions, Next: Function Calls, Pre =============================== In certain contexts, expression values also serve as "truth values"; -(i.e., they determine what should happen next as the program runs). This +i.e., they determine what should happen next as the program runs. This minor node describes how `awk' defines "true" and "false" and how values are compared. @@ -8307,10 +8312,10 @@ File: gawk.info, Node: Typing and Comparison, Next: Boolean Ops, Prev: Truth The Guide is definitive. Reality is frequently inaccurate. -- Douglas Adams, `The Hitchhiker's Guide to the Galaxy' - Unlike other programming languages, `awk' variables do not have a -fixed type. Instead, they can be either a number or a string, depending -upon the value that is assigned to them. We look now at how variables -are typed, and how `awk' compares variables. + Unlike in other programming languages, in `awk' variables do not +have a fixed type. Instead, they can be either a number or a string, +depending upon the value that is assigned to them. We look now at how +variables are typed, and how `awk' compares variables. * Menu: @@ -8331,16 +8336,16 @@ of the variable is important because the types of two variables determine how they are compared. Variable typing follows these rules: * A numeric constant or the result of a numeric operation has the - NUMERIC attribute. + "numeric" attribute. * A string constant or the result of a string operation has the - STRING attribute. + "string" attribute. * Fields, `getline' input, `FILENAME', `ARGV' elements, `ENVIRON' elements, and the elements of an array created by `match()', `split()', and `patsplit()' that are numeric strings have the - STRNUM attribute. Otherwise, they have the STRING attribute. - Uninitialized variables also have the STRNUM attribute. + "strnum" attribute. Otherwise, they have the "string" attribute. + Uninitialized variables also have the "strnum" attribute. * Attributes propagate across assignments but are not changed by any use. @@ -8382,12 +8387,13 @@ constant, then a string comparison is performed. Otherwise, a numeric comparison is performed. This point bears additional emphasis: All user input is made of -characters, and so is first and foremost of STRING type; input strings -that look numeric are additionally given the STRNUM attribute. Thus, -the six-character input string ` +3.14' receives the STRNUM attribute. +characters, and so is first and foremost of string type; input strings +that look numeric are additionally given the strnum attribute. Thus, +the six-character input string ` +3.14' receives the strnum attribute. In contrast, the eight characters `" +3.14"' appearing in program text comprise a string constant. The following examples print `1' when the -comparison between the two different constants is true, `0' otherwise: +comparison between the two different constants is true, and `0' +otherwise: $ echo ' +3.14' | awk '{ print($0 == " +3.14") }' True -| 1 @@ -8486,7 +8492,7 @@ comparison is: -| false the result is `false' because both `$1' and `$2' are user input. They -are numeric strings--therefore both have the STRNUM attribute, +are numeric strings--therefore both have the strnum attribute, dictating a numeric comparison. The purpose of the comparison rules and the use of numeric strings is to attempt to produce the behavior that is "least surprising," while still "doing the right thing." @@ -8545,7 +8551,7 @@ is an example to illustrate the difference, in an `en_US.UTF-8' locale: ---------- Footnotes ---------- (1) Technically, string comparison is supposed to behave the same -way as if the strings are compared with the C `strcoll()' function. +way as if the strings were compared with the C `strcoll()' function. File: gawk.info, Node: Boolean Ops, Next: Conditional Exp, Prev: Typing and Comparison, Up: Truth Values and Conditions @@ -8608,7 +8614,7 @@ Boolean operators are: The `&&' and `||' operators are called "short-circuit" operators because of the way they work. Evaluation of the full expression is -"short-circuited" if the result can be determined part way through its +"short-circuited" if the result can be determined partway through its evaluation. Statements that end with `&&' or `||' can be continued simply by @@ -8661,15 +8667,15 @@ File: gawk.info, Node: Conditional Exp, Prev: Boolean Ops, Up: Truth Values a A "conditional expression" is a special kind of expression that has three operands. It allows you to use one expression's value to select -one of two other expressions. The conditional expression is the same -as in the C language, as shown here: +one of two other expressions. The conditional expression in `awk' is +the same as in the C language, as shown here: SELECTOR ? IF-TRUE-EXP : IF-FALSE-EXP There are three subexpressions. The first, SELECTOR, is always computed first. If it is "true" (not zero or not null), then -IF-TRUE-EXP is computed next and its value becomes the value of the -whole expression. Otherwise, IF-FALSE-EXP is computed next and its +IF-TRUE-EXP is computed next, and its value becomes the value of the +whole expression. Otherwise, IF-FALSE-EXP is computed next, and its value becomes the value of the whole expression. For example, the following expression produces the absolute value of `x': @@ -8703,7 +8709,7 @@ A "function" is a name for a particular calculation. This enables you to ask for it by name at any point in the program. For example, the function `sqrt()' computes the square root of a number. - A fixed set of functions are "built-in", which means they are + A fixed set of functions are "built in", which means they are available in every `awk' program. The `sqrt()' function is one of these. *Note Built-in::, for a list of built-in functions and their descriptions. In addition, you can define functions for use in your @@ -8838,7 +8844,7 @@ precedence: Increment, decrement. `^ **' - Exponentiation. These operators group right-to-left. + Exponentiation. These operators group right to left. `+ - !' Unary plus, minus, logical "not." @@ -8865,7 +8871,7 @@ String concatenation operand of another operator. As a result, it does not make sense to use a redirection operator near another operator of lower precedence without parentheses. Such combinations (e.g., `print - foo > a ? b : c'), result in syntax errors. The correct way to + foo > a ? b : c') result in syntax errors. The correct way to write this statement is `print foo > (a ? b : c)'. `~ !~' @@ -8875,16 +8881,16 @@ String concatenation Array membership. `&&' - Logical "and". + Logical "and." `||' - Logical "or". + Logical "or." `?:' - Conditional. This operator groups right-to-left. + Conditional. This operator groups right to left. `= += -= *= /= %= ^= **=' - Assignment. These operators group right-to-left. + Assignment. These operators group right to left. NOTE: The `|&', `**', and `**=' operators are not specified by POSIX. For maximum portability, do not use them. @@ -8952,24 +8958,24 @@ File: gawk.info, Node: Expressions Summary, Prev: Locales, Up: Expressions * `awk' provides the usual arithmetic operators (addition, subtraction, multiplication, division, modulus), and unary plus - and minus. It also provides comparison operators, boolean - operators, array membership testing, and regexp matching - operators. String concatenation is accomplished by placing two - expressions next to each other; there is no explicit operator. - The three-operand `?:' operator provides an "if-else" test within - expressions. + and minus. It also provides comparison operators, Boolean + operators, an array membership testing operator, and regexp + matching operators. String concatenation is accomplished by + placing two expressions next to each other; there is no explicit + operator. The three-operand `?:' operator provides an "if-else" + test within expressions. * Assignment operators provide convenient shorthands for common arithmetic operations. - * In `awk', a value is considered to be true if it is non-zero _or_ + * In `awk', a value is considered to be true if it is nonzero _or_ non-null. Otherwise, the value is false. * A variable's type is set upon each assignment and may change over its lifetime. The type determines how it behaves in comparisons (string or numeric). - * Function calls return a value which may be used as part of a larger + * Function calls return a value that may be used as part of a larger expression. Expressions used to pass parameter values are fully evaluated before the function is called. `awk' provides built-in and user-defined functions; this is described in *note Functions::. @@ -9143,7 +9149,7 @@ inside Boolean patterns. Likewise, the special patterns `BEGIN', `END', `BEGINFILE', and `ENDFILE', which never match any input record, are not expressions and cannot appear inside Boolean patterns. - The precedence of the different operators which can appear in + The precedence of the different operators that can appear in patterns is described in *note Precedence::. @@ -9163,8 +9169,8 @@ following: prints every record in `myfile' between `on'/`off' pairs, inclusive. A range pattern starts out by matching BEGPAT against every input -record. When a record matches BEGPAT, the range pattern is "turned on" -and the range pattern matches this record as well. As long as the +record. When a record matches BEGPAT, the range pattern is "turned +on", and the range pattern matches this record as well. As long as the range pattern stays turned on, it automatically matches every input record read. The range pattern also matches ENDPAT against every input record; when this succeeds, the range pattern is "turned off" again for @@ -9282,7 +9288,7 @@ for more information on using library functions. *Note Library Functions::, for a number of useful library functions. If an `awk' program has only `BEGIN' rules and no other rules, then -the program exits after the `BEGIN' rule is run.(1) However, if an +the program exits after the `BEGIN' rules are run.(1) However, if an `END' rule exists, then the input is read, even if there are no other rules in the program. This is necessary in case the `END' rule checks the `FNR' and `NR' variables. @@ -9308,7 +9314,7 @@ give `$0' a real value is to execute a `getline' command without a variable (*note Getline::). Another way is simply to assign a value to `$0'. - The second point is similar to the first but from the other + The second point is similar to the first, but from the other direction. Traditionally, due largely to implementation issues, `$0' and `NF' were _undefined_ inside an `END' rule. The POSIX standard specifies that `NF' is available in an `END' rule. It contains the @@ -9369,7 +9375,7 @@ tasks that would otherwise be difficult or impossible to perform: entirely. Otherwise, `gawk' exits with the usual fatal error. * If you have written extensions that modify the record handling (by - inserting an "input parser," *note Input Parsers::), you can invoke + inserting an "input parser"; *note Input Parsers::), you can invoke them at this point, before `gawk' has started processing the file. (This is a _very_ advanced feature, currently used only by the `gawkextlib' project (http://gawkextlib.sourceforge.net).) @@ -9379,16 +9385,15 @@ last record in an input file. For the last input file, it will be called before any `END' rules. The `ENDFILE' rule is executed even for empty input files. - Normally, when an error occurs when reading input in the normal input -processing loop, the error is fatal. However, if an `ENDFILE' rule is -present, the error becomes non-fatal, and instead `ERRNO' is set. This -makes it possible to catch and process I/O errors at the level of the -`awk' program. + Normally, when an error occurs when reading input in the normal +input-processing loop, the error is fatal. However, if an `ENDFILE' +rule is present, the error becomes non-fatal, and instead `ERRNO' is +set. This makes it possible to catch and process I/O errors at the +level of the `awk' program. The `next' statement (*note Next Statement::) is not allowed inside either a `BEGINFILE' or an `ENDFILE' rule. The `nextfile' statement is -allowed only inside a `BEGINFILE' rule, but not inside an `ENDFILE' -rule. +allowed only inside a `BEGINFILE' rule, not inside an `ENDFILE' rule. The `getline' statement (*note Getline::) is restricted inside both `BEGINFILE' and `ENDFILE': only redirected forms of `getline' are @@ -9433,11 +9438,11 @@ following program: END { print nmatches, "found" }' /path/to/data The `awk' program consists of two pieces of quoted text that are -concatenated together to form the program. The first part is double -quoted, which allows substitution of the `pattern' shell variable -inside the quotes. The second part is single quoted. +concatenated together to form the program. The first part is +double-quoted, which allows substitution of the `pattern' shell +variable inside the quotes. The second part is single-quoted. - Variable substitution via quoting works, but can be potentially + Variable substitution via quoting works, but can potentially be messy. It requires a good understanding of the shell's quoting rules (*note Quoting::), and it's often difficult to correctly match up the quotes when reading the program. @@ -9634,15 +9639,15 @@ The body of this loop is a compound statement enclosed in braces, containing two statements. The loop works in the following manner: first, the value of `i' is set to one. Then, the `while' statement tests whether `i' is less than or equal to three. This is true when -`i' equals one, so the `i'-th field is printed. Then the `i++' +`i' equals one, so the `i'th field is printed. Then the `i++' increments the value of `i' and the loop repeats. The loop terminates when `i' reaches four. A newline is not required between the condition and the body; however, using one makes the program clearer unless the body is a -compound statement or else is very simple. The newline after the -open-brace that begins the compound statement is not required either, -but the program is harder to read without it. +compound statement or else is very simple. The newline after the open +brace that begins the compound statement is not required either, but the +program is harder to read without it. File: gawk.info, Node: Do Statement, Next: For Statement, Prev: While Statement, Up: Statements @@ -9665,7 +9670,7 @@ Contrast this with the corresponding `while' statement: while (CONDITION) BODY -This statement does not execute BODY even once if the CONDITION is +This statement does not execute the BODY even once if the CONDITION is false to begin with. The following is an example of a `do' statement: { @@ -9721,7 +9726,7 @@ loop.) The same is true of the INCREMENT part. Incrementing additional variables requires separate statements at the end of the loop. The C compound expression, using C's comma operator, is useful in this -context but it is not supported in `awk'. +context, but it is not supported in `awk'. Most often, INCREMENT is an increment expression, as in the previous example. But this is not required; it can be any expression @@ -9797,7 +9802,7 @@ statement looks like this: Control flow in the `switch' statement works as it does in C. Once a match to a given case is made, the case statement bodies execute until -a `break', `continue', `next', `nextfile' or `exit' is encountered, or +a `break', `continue', `next', `nextfile', or `exit' is encountered, or the end of the `switch' statement itself. For example: while ((c = getopt(ARGC, ARGV, "aksx")) != -1) { @@ -10040,12 +10045,11 @@ listed in `ARGV'. standard. See the Austin Group website (http://austingroupbugs.net/view.php?id=607). - The current version of BWK `awk', and `mawk' also support -`nextfile'. However, they don't allow the `nextfile' statement inside -function bodies (*note User-defined::). `gawk' does; a `nextfile' -inside a function body reads the next record and starts processing it -with the first rule in the program, just as any other `nextfile' -statement. + The current version of BWK `awk' and `mawk' also support `nextfile'. +However, they don't allow the `nextfile' statement inside function +bodies (*note User-defined::). `gawk' does; a `nextfile' inside a +function body reads the next record and starts processing it with the +first rule in the program, just as any other `nextfile' statement. File: gawk.info, Node: Exit Statement, Prev: Nextfile Statement, Up: Statements @@ -10073,9 +10077,9 @@ record, skips reading any remaining input records, and executes the they do not execute. In such a case, if you don't want the `END' rule to do its job, set -a variable to nonzero before the `exit' statement and check that -variable in the `END' rule. *Note Assert Function::, for an example -that does this. +a variable to a nonzero value before the `exit' statement and check +that variable in the `END' rule. *Note Assert Function::, for an +example that does this. If an argument is supplied to `exit', its value is used as the exit status code for the `awk' process. If no argument is supplied, `exit' @@ -10133,7 +10137,7 @@ of activity. File: gawk.info, Node: User-modified, Next: Auto-set, Up: Built-in Variables -7.5.1 Built-In Variables That Control `awk' +7.5.1 Built-in Variables That Control `awk' ------------------------------------------- The following is an alphabetical list of variables that you can change @@ -10157,11 +10161,11 @@ description of each variable.) use binary I/O. Any other string value is treated the same as `"rw"', but causes `gawk' to generate a warning message. `BINMODE' is described in more detail in *note PC Using::. `mawk' - (*note Other Versions::), also supports this variable, but only + (*note Other Versions::) also supports this variable, but only using numeric values. ``CONVFMT'' - This string controls conversion of numbers to strings (*note + A string that controls the conversion of numbers to strings (*note Conversion::). It works by being passed, in effect, as the first argument to the `sprintf()' function (*note String Functions::). Its default value is `"%.6g"'. `CONVFMT' was introduced by the @@ -10208,7 +10212,7 @@ description of each variable.) `IGNORECASE #' If `IGNORECASE' is nonzero or non-null, then all string comparisons - and all regular expression matching are case independent. Thus, + and all regular expression matching are case-independent. Thus, regexp matching with `~' and `!~', as well as the `gensub()', `gsub()', `index()', `match()', `patsplit()', `split()', and `sub()' functions, record termination with `RS', and field @@ -10228,7 +10232,7 @@ description of each variable.) Assigning a false value to `LINT' turns off the lint warnings. This variable is a `gawk' extension. It is not special in other - `awk' implementations. Unlike the other special variables, + `awk' implementations. Unlike with the other special variables, changing `LINT' does affect the production of lint warnings, even if `gawk' is in compatibility mode. Much as the `--lint' and `--traditional' options independently control different aspects of @@ -10236,17 +10240,18 @@ description of each variable.) execution is independent of the flavor of `awk' being executed. `OFMT' - Controls conversion of numbers to strings (*note Conversion::) for - printing with the `print' statement. It works by being passed as - the first argument to the `sprintf()' function (*note String - Functions::). Its default value is `"%.6g"'. Earlier versions of - `awk' used `OFMT' to specify the format for converting numbers to - strings in general expressions; this is now done by `CONVFMT'. + A string that controls conversion of numbers to strings (*note + Conversion::) for printing with the `print' statement. It works + by being passed as the first argument to the `sprintf()' function + (*note String Functions::). Its default value is `"%.6g"'. + Earlier versions of `awk' used `OFMT' to specify the format for + converting numbers to strings in general expressions; this is now + done by `CONVFMT'. `OFS' - This is the output field separator (*note Output Separators::). - It is output between the fields printed by a `print' statement. - Its default value is `" "', a string consisting of a single space. + The output field separator (*note Output Separators::). It is + output between the fields printed by a `print' statement. Its + default value is `" "', a string consisting of a single space. `ORS' The output record separator. It is output at the end of every @@ -10296,7 +10301,7 @@ description of each variable.) File: gawk.info, Node: Auto-set, Next: ARGC and ARGV, Prev: User-modified, Up: Built-in Variables -7.5.2 Built-In Variables That Convey Information +7.5.2 Built-in Variables That Convey Information ------------------------------------------------ The following is an alphabetical list of variables that `awk' sets @@ -10419,14 +10424,14 @@ Options::), they are not special: `NF' The number of fields in the current input record. `NF' is set - each time a new record is read, when a new field is created or + each time a new record is read, when a new field is created, or when `$0' changes (*note Fields::). Unlike most of the variables described in this node, assigning a value to `NF' has the potential to affect `awk''s internal workings. In particular, assignments to `NF' can be used to - create or remove fields from the current record. *Note Changing - Fields::. + create fields in or remove fields from the current record. *Note + Changing Fields::. `FUNCTAB #' An array whose indices and corresponding values are the names of @@ -10465,7 +10470,7 @@ Options::), they are not special: `PROCINFO["identifiers"]' A subarray, indexed by the names of all identifiers used in - the text of the AWK program. An "identifier" is simply the + the text of the `awk' program. An "identifier" is simply the name of a variable (be it scalar or array), built-in function, user-defined function, or extension function. For each identifier, the value of the element is one of the @@ -10486,7 +10491,7 @@ Options::), they are not special: `"untyped"' The identifier is untyped (could be used as a scalar or - array, `gawk' doesn't know yet). + an array; `gawk' doesn't know yet). `"user"' The identifier is a user-defined function. @@ -10579,7 +10584,7 @@ Options::), they are not special: string, or -1 if no match is found. `RSTART' - The start-index in characters of the substring that is matched by + The start index in characters of the substring that is matched by the `match()' function (*note String Functions::). `RSTART' is set by invoking the `match()' function. Its value is the position of the string where the matched substring starts, or zero if no @@ -10629,7 +10634,7 @@ Options::), they are not special: } NOTE: In order to avoid severe time-travel paradoxes,(2) - neither `FUNCTAB' nor `SYMTAB' are available as elements + neither `FUNCTAB' nor `SYMTAB' is available as an element within the `SYMTAB' array. Changing `NR' and `FNR' @@ -10768,7 +10773,7 @@ are passed on to the `awk' program. (*Note Getopt Function::, for an When designing your program, you should choose options that don't conflict with `gawk''s, because it will process any options that it accepts before passing the rest of the command line on to your program. -Using `#!' with the `-E' option may help (*Note Executable Scripts::, +Using `#!' with the `-E' option may help (*note Executable Scripts::, and *note Options::,). @@ -10779,14 +10784,14 @@ File: gawk.info, Node: Pattern Action Summary, Prev: Built-in Variables, Up: * Pattern-action pairs make up the basic elements of an `awk' program. Patterns are either normal expressions, range - expressions, regexp constants, one of the special keywords - `BEGIN', `END', `BEGINFILE', `ENDFILE', or empty. The action + expressions, or regexp constants; one of the special keywords + `BEGIN', `END', `BEGINFILE', or `ENDFILE'; or empty. The action executes if the current record matches the pattern. Empty (missing) patterns match all records. - * I/O from `BEGIN' and `END' rules have certain constraints. This - is also true, only more so, for `BEGINFILE' and `ENDFILE' rules. - The latter two give you "hooks" into `gawk''s file processing, + * I/O from `BEGIN' and `END' rules has certain constraints. This is + also true, only more so, for `BEGINFILE' and `ENDFILE' rules. The + latter two give you "hooks" into `gawk''s file processing, allowing you to recover from a file that otherwise would cause a fatal error (such as a file that cannot be opened). @@ -10807,11 +10812,11 @@ File: gawk.info, Node: Pattern Action Summary, Prev: Built-in Variables, Up: iteration of a loop (or get out of a `switch'). * `next' and `nextfile' let you read the next record and start over - at the top of your program, or skip to the next input file and + at the top of your program or skip to the next input file and start over, respectively. * The `exit' statement terminates your program. When executed from - an action (or function body) it transfers control to the `END' + an action (or function body), it transfers control to the `END' statements. From an `END' statement body, it exits immediately. You may pass an optional numeric value to be used as `awk''s exit status. @@ -10913,9 +10918,9 @@ languages allow arbitrary starting and ending indices--e.g., `15 .. 27'--but the size of the array is still fixed when the array is declared.) - A contiguous array of four elements might look like the following -example, conceptually, if the element values are 8, `"foo"', `""', and -30 as shown in *note figure-array-elements::: + A contiguous array of four elements might look like *note +figure-array-elements::, conceptually, if the element values are eight, +`"foo"', `""', and 30. +---------+---------+--------+---------+ | 8 | "foo" | "" | 30 | @r{Value} @@ -10924,17 +10929,19 @@ example, conceptually, if the element values are 8, `"foo"', `""', and Figure 8.1: A contiguous array Only the values are stored; the indices are implicit from the order of -the values. Here, 8 is the value at index zero, because 8 appears in the -position with zero elements before it. +the values. Here, eight is the value at index zero, because eight +appears in the position with zero elements before it. Arrays in `awk' are different--they are "associative". This means that each array is a collection of pairs--an index and its corresponding array element value: - Index 3 Value 30 - Index 1 Value "foo" - Index 0 Value 8 - Index 2 Value "" + Index Value +------------------------ + `3' `30' + `1' `"foo"' + `0' `8' + `2' `""' The pairs are shown in jumbled order because their order is irrelevant.(1) @@ -10943,11 +10950,13 @@ irrelevant.(1) at any time. For example, suppose a tenth element is added to the array whose value is `"number ten"'. The result is: - Index 10 Value "number ten" - Index 3 Value 30 - Index 1 Value "foo" - Index 0 Value 8 - Index 2 Value "" + Index Value +------------------------------- + `10' `"number ten"' + `3' `30' + `1' `"foo"' + `0' `8' + `2' `""' Now the array is "sparse", which just means some indices are missing. It has elements 0-3 and 10, but doesn't have elements 4, 5, 6, 7, 8, or @@ -10958,17 +10967,19 @@ have to be positive integers. Any number, or even a string, can be an index. For example, the following is an array that translates words from English to French: - Index "dog" Value "chien" - Index "cat" Value "chat" - Index "one" Value "un" - Index 1 Value "un" + Index Value +------------------------ + `"dog"' `"chien"' + `"cat"' `"chat"' + `"one"' `"un"' + `1' `"un"' Here we decided to translate the number one in both spelled-out and numeric form--thus illustrating that a single array can have both numbers and strings as indices. (In fact, array subscripts are always strings. There are some subtleties to how numbers work when used as array subscripts; this is discussed in more detail in *note Numeric -Array Subscripts::.) Here, the number `1' isn't double quoted, because +Array Subscripts::.) Here, the number `1' isn't double-quoted, because `awk' automatically converts it to a string. The value of `IGNORECASE' has no effect upon array subscripting. @@ -10992,7 +11003,7 @@ File: gawk.info, Node: Reference to Elements, Next: Assigning Elements, Prev: ----------------------------------- The principal way to use an array is to refer to one of its elements. -An array reference is an expression as follows: +An "array reference" is an expression as follows: ARRAY[INDEX-EXPRESSION] @@ -11000,8 +11011,8 @@ Here, ARRAY is the name of an array. The expression INDEX-EXPRESSION is the index of the desired element of the array. The value of the array reference is the current value of that array -element. For example, `foo[4.3]' is an expression for the element of -array `foo' at index `4.3'. +element. For example, `foo[4.3]' is an expression referencing the +element of array `foo' at index `4.3'. A reference to an array element that has no recorded value yields a value of `""', the null string. This includes elements that have not @@ -11068,7 +11079,7 @@ File: gawk.info, Node: Array Example, Next: Scanning an Array, Prev: Assignin The following program takes a list of lines, each beginning with a line number, and prints them out in order of line number. The line numbers -are not in order when they are first read--instead they are scrambled. +are not in order when they are first read--instead, they are scrambled. This program sorts the lines by making an array using the line numbers as subscripts. The program then prints out the lines in sorted order of their numbers. It is a very simple program and gets confused upon @@ -11139,7 +11150,7 @@ has previously used, with the variable VAR set to that index. The following program uses this form of the `for' statement. The first rule scans the input records and notes which words appear (at least once) in the input, by storing a one into the array `used' with -the word as index. The second rule scans the elements of `used' to +the word as the index. The second rule scans the elements of `used' to find all the distinct words that appear in the input. It prints each word that is more than 10 characters long and also prints the number of such words. *Note String Functions::, for more information on the @@ -11222,7 +11233,7 @@ internal implementation of arrays and will vary from one version of Often, though, you may wish to do something simple, such as "traverse the array by comparing the indices in ascending order," or "traverse the array by comparing the values in descending order." -`gawk' provides two mechanisms which give you this control. +`gawk' provides two mechanisms that give you this control: * Set `PROCINFO["sorted_in"]' to one of a set of predefined values. We describe this now. @@ -11270,22 +11281,26 @@ available: which `gawk' uses internally to perform the sorting. `"@ind_str_desc"' - String indices ordered from high to low. + Like `"@ind_str_asc"', but the string indices are ordered from + high to low. `"@ind_num_desc"' - Numeric indices ordered from high to low. + Like `"@ind_num_asc"', but the numeric indices are ordered from + high to low. `"@val_type_desc"' - Element values, based on type, ordered from high to low. - Subarrays, if present, come out first. + Like `"@val_type_asc"', but the element values, based on type, are + ordered from high to low. Subarrays, if present, come out first. `"@val_str_desc"' - Element values, treated as strings, ordered from high to low. - Subarrays, if present, come out first. + Like `"@val_str_asc"', but the element values, treated as strings, + are ordered from high to low. Subarrays, if present, come out + first. `"@val_num_desc"' - Element values, treated as numbers, ordered from high to low. - Subarrays, if present, come out first. + Like `"@val_num_asc"', but the element values, treated as numbers, + are ordered from high to low. Subarrays, if present, come out + first. The array traversal order is determined before the `for' loop starts to run. Changing `PROCINFO["sorted_in"]' in the loop body does not @@ -11471,8 +11486,8 @@ deleting elements in an array: This example removes all the elements from the array `frequencies'. Once an element is deleted, a subsequent `for' statement to scan the -array does not report that element and the `in' operator to check for -the presence of that element returns zero (i.e., false): +array does not report that element and using the `in' operator to check +for the presence of that element returns zero (i.e., false): delete foo[4] if (4 in foo) @@ -11675,7 +11690,7 @@ two-element subarray at index `1' of the main array `a': This simulates a true two-dimensional array. Each subarray element can contain another subarray as a value, which in turn can hold other arrays as well. In this way, you can create arrays of three or more -dimensions. The indices can be any `awk' expression, including scalars +dimensions. The indices can be any `awk' expressions, including scalars separated by commas (i.e., a regular `awk' simulated multidimensional subscript). So the following is valid in `gawk': @@ -11684,7 +11699,7 @@ subscript). So the following is valid in `gawk': Each subarray and the main array can be of different length. In fact, the elements of an array or its subarray do not all have to have the same type. This means that the main array and any of its subarrays -can be non-rectangular, or jagged in structure. You can assign a scalar +can be nonrectangular, or jagged in structure. You can assign a scalar value to the index `4' of the main array `a', even though `a[1]' is itself an array and not a scalar: @@ -11702,8 +11717,8 @@ the element at that index: a[4][5][6][7] = "An element in a four-dimensional array" This removes the scalar value from index `4' and then inserts a -subarray of subarray of subarray containing a scalar. You can also -delete an entire subarray or subarray of subarrays: +three-level nested subarray containing a scalar. You can also delete an +entire subarray or subarray of subarrays: delete a[4][5] a[4][5] = "An element in subarray a[4]" @@ -11711,7 +11726,7 @@ delete an entire subarray or subarray of subarrays: But recall that you can not delete the main array `a' and then use it as a scalar. - The built-in functions which take array arguments can also be used + The built-in functions that take array arguments can also be used with subarrays. For example, the following code fragment uses `length()' (*note String Functions::) to determine the number of elements in the main array `a' and its subarrays: @@ -11732,7 +11747,7 @@ be nested to scan all the elements of an array of arrays if it is rectangular in structure. In order to print the contents (scalar values) of a two-dimensional array of arrays (i.e., in which each first-level element is itself an array, not necessarily of the same -length) you could use the following code: +length), you could use the following code: for (i in array) for (j in array[i]) @@ -11814,9 +11829,9 @@ File: gawk.info, Node: Arrays Summary, Prev: Arrays of Arrays, Up: Arrays of `awk'. * Standard `awk' simulates multidimensional arrays by separating - subscript values with a comma. The values are concatenated into a + subscript values with commas. The values are concatenated into a single string, separated by the value of `SUBSEP'. The fact that - such a subscript was created in this way is not retained; thus + such a subscript was created in this way is not retained; thus, changing `SUBSEP' may have unexpected consequences. You can use `(SUB1, SUB2, ...) in ARRAY' to see if such a multidimensional subscript exists in ARRAY. @@ -11824,7 +11839,7 @@ File: gawk.info, Node: Arrays Summary, Prev: Arrays of Arrays, Up: Arrays * `gawk' provides true arrays of arrays. You use a separate set of square brackets for each dimension in such an array: `data[row][col]', for example. Array elements may thus be either - scalar values (number or string) or another array. + scalar values (number or string) or other arrays. * Use the `isarray()' built-in function to determine if an array element is itself a subarray. @@ -11844,7 +11859,9 @@ internationalize and localize programs. Besides the built-in functions, `awk' has provisions for writing new functions that the rest of a program can use. The second half of this -major node describes these "user-defined" functions. +major node describes these "user-defined" functions. Finally, we +explore indirect function calls, a `gawk'-specific extension that lets +you determine at runtime what function is to be called. * Menu: @@ -11856,7 +11873,7 @@ major node describes these "user-defined" functions. File: gawk.info, Node: Built-in, Next: User-defined, Up: Functions -9.1 Built-In Functions +9.1 Built-in Functions ====================== "Built-in" functions are always available for your `awk' program to @@ -11881,7 +11898,7 @@ for your convenience. File: gawk.info, Node: Calling Built-in, Next: Numeric Functions, Up: Built-in -9.1.1 Calling Built-In Functions +9.1.1 Calling Built-in Functions -------------------------------- To call one of `awk''s built-in functions, write the name of the @@ -11918,9 +11935,10 @@ are evaluated from left to right or from right to left. For example: j = atan2(++i, i *= 2) If the order of evaluation is left to right, then `i' first becomes -6, and then 12, and `atan2()' is called with the two arguments 6 and -12. But if the order of evaluation is right to left, `i' first becomes -10, then 11, and `atan2()' is called with the two arguments 11 and 10. +six, and then 12, and `atan2()' is called with the two arguments six +and 12. But if the order of evaluation is right to left, `i' first +becomes 10, then 11, and `atan2()' is called with the two arguments 11 +and 10. File: gawk.info, Node: Numeric Functions, Next: String Functions, Prev: Calling Built-in, Up: Built-in @@ -11976,7 +11994,7 @@ brackets ([ ]): Often random integers are needed instead. Following is a user-defined function that can be used to obtain a random - non-negative integer less than N: + nonnegative integer less than N: function randint(n) { @@ -12066,7 +12084,7 @@ File: gawk.info, Node: String Functions, Next: I/O Functions, Prev: Numeric F The functions in this minor node look at or change the text of one or more strings. - `gawk' understands locales (*note Locales::), and does all string + `gawk' understands locales (*note Locales::) and does all string processing in terms of _characters_, not _bytes_. This distinction is particularly important to understand for locales where one character may be represented by multiple bytes. Thus, for example, `length()' @@ -12137,7 +12155,7 @@ Options::): a[2] = "de" a[3] = "sac" - The `asorti()' function works similarly to `asort()', however, the + The `asorti()' function works similarly to `asort()'; however, the _indices_ are sorted, instead of the values. Thus, in the previous example, starting with the same initial set of indices and values in `a', calling `asorti(a)' would yield: @@ -12225,7 +12243,7 @@ Options::): With BWK `awk' and `gawk', it is a fatal error to use a regexp constant for FIND. Other implementations allow it, simply treating the regexp constant as an expression meaning `$0 ~ - /regexp/'. (d.c.). + /regexp/'. (d.c.) `length('[STRING]`)' Return the number of characters in STRING. If STRING is a number, @@ -12269,9 +12287,9 @@ Options::): `match(STRING, REGEXP' [`, ARRAY']`)' Search STRING for the longest, leftmost substring matched by the - regular expression, REGEXP and return the character position - (index) at which that substring begins (one, if it starts at the - beginning of STRING). If no match is found, return zero. + regular expression REGEXP and return the character position (index) + at which that substring begins (one, if it starts at the beginning + of STRING). If no match is found, return zero. The REGEXP argument may be either a regexp constant (`/'...`/') or a string constant (`"'...`"'). In the latter case, the string is @@ -12279,7 +12297,7 @@ Options::): discussion of the difference between the two forms, and the implications for writing your program correctly. - The order of the first two arguments is backwards from most other + The order of the first two arguments is the opposite of most other string functions that work with regular expressions, such as `sub()' and `gsub()'. It might help to remember that for `match()', the order is the same as for the `~' operator: `STRING @@ -12346,8 +12364,8 @@ Options::): There may not be subscripts for the start and index for every parenthesized subexpression, because they may not all have matched - text; thus they should be tested for with the `in' operator (*note - Reference to Elements::). + text; thus, they should be tested for with the `in' operator + (*note Reference to Elements::). The ARRAY argument to `match()' is a `gawk' extension. In compatibility mode (*note Options::), using a third argument is a @@ -12380,19 +12398,19 @@ Options::): FIELDSEP, is a regexp describing where to split STRING (much as `FS' can be a regexp describing where to split input records). If FIELDSEP is omitted, the value of `FS' is used. `split()' returns - the number of elements created. SEPS is a `gawk' extension with + the number of elements created. SEPS is a `gawk' extension, with `SEPS[I]' being the separator string between `ARRAY[I]' and - `ARRAY[I+1]'. If FIELDSEP is a single space then any leading + `ARRAY[I+1]'. If FIELDSEP is a single space, then any leading whitespace goes into `SEPS[0]' and any trailing whitespace goes - into `SEPS[N]' where N is the return value of `split()' (i.e., the - number of elements in ARRAY). + into `SEPS[N]', where N is the return value of `split()' (i.e., + the number of elements in ARRAY). The `split()' function splits strings into pieces in a manner similar to the way input lines are split into fields. For example: split("cul-de-sac", a, "-", seps) - splits the string `cul-de-sac' into three fields using `-' as the + splits the string `"cul-de-sac"' into three fields using `-' as the separator. It sets the contents of the array `a' as follows: a[1] = "cul" @@ -12409,17 +12427,18 @@ Options::): As with input field-splitting, when the value of FIELDSEP is `" "', leading and trailing whitespace is ignored in values assigned to the elements of ARRAY but not in SEPS, and the elements - are separated by runs of whitespace. Also, as with input - field-splitting, if FIELDSEP is the null string, each individual + are separated by runs of whitespace. Also, as with input field + splitting, if FIELDSEP is the null string, each individual character in the string is split into its own array element. (c.e.) Note, however, that `RS' has no effect on the way `split()' works. - Even though `RS = ""' causes newline to also be an input field - separator, this does not affect how `split()' splits strings. + Even though `RS = ""' causes the newline character to also be an + input field separator, this does not affect how `split()' splits + strings. Modern implementations of `awk', including `gawk', allow the third - argument to be a regexp constant (`/abc/') as well as a string. + argument to be a regexp constant (`/'...`/') as well as a string. (d.c.) The POSIX standard allows this as well. *Note Computed Regexps::, for a discussion of the difference between using a string constant or a regexp constant, and the implications for @@ -12520,7 +12539,7 @@ Options::): { sub(/\|/, "\\&"); print } As mentioned, the third argument to `sub()' must be a variable, - field or array element. Some versions of `awk' allow the third + field, or array element. Some versions of `awk' allow the third argument to be an expression that is not an lvalue. In such a case, `sub()' still searches for the pattern and returns zero or one, but the result of the substitution (if any) is thrown away @@ -12645,11 +12664,11 @@ example, `"a\qb"' is treated as `"aqb"'. At the runtime level, the various functions handle sequences of `\' and `&' differently. The situation is (sadly) somewhat complex. -Historically, the `sub()' and `gsub()' functions treated the two -character sequence `\&' specially; this sequence was replaced in the -generated text with a single `&'. Any other `\' within the REPLACEMENT -string that did not precede an `&' was passed through unchanged. This -is illustrated in *note table-sub-escapes::. +Historically, the `sub()' and `gsub()' functions treated the +two-character sequence `\&' specially; this sequence was replaced in +the generated text with a single `&'. Any other `\' within the +REPLACEMENT string that did not precede an `&' was passed through +unchanged. This is illustrated in *note table-sub-escapes::. You type `sub()' sees `sub()' generates ------- --------- -------------- @@ -12664,10 +12683,10 @@ is illustrated in *note table-sub-escapes::. Table 9.1: Historical escape sequence processing for `sub()' and `gsub()' -This table shows both the lexical-level processing, where an odd number -of backslashes becomes an even number at the runtime level, as well as -the runtime processing done by `sub()'. (For the sake of simplicity, -the rest of the following tables only show the case of even numbers of +This table shows the lexical-level processing, where an odd number of +backslashes becomes an even number at the runtime level, as well as the +runtime processing done by `sub()'. (For the sake of simplicity, the +rest of the following tables only show the case of even numbers of backslashes entered at the lexical level.) The problem with the historical approach is that there is no way to @@ -12691,10 +12710,10 @@ This is shown in *note table-sub-proposed::. `\\q' `\q' A literal `\q' `\\\\' `\\' `\\' -Table 9.2: GNU `awk' rules for `sub()' and backslash +Table 9.2: `gawk' rules for `sub()' and backslash In a nutshell, at the runtime level, there are now three special -sequences of characters (`\\\&', `\\&' and `\&') whereas historically +sequences of characters (`\\\&', `\\&', and `\&') whereas historically there was only one. However, as in the historical case, any `\' that is not part of one of these three sequences is not special and appears in the output literally. @@ -12724,7 +12743,7 @@ Table 9.3: POSIX rules for `sub()' and `gsub()' `\\\\' is seen as `\\' and produces `\' instead of `\\'. Starting with version 3.1.4, `gawk' followed the POSIX rules when -`--posix' is specified (*note Options::). Otherwise, it continued to +`--posix' was specified (*note Options::). Otherwise, it continued to follow the proposed rules, as that had been its behavior for many years. When version 4.0.0 was released, the `gawk' maintainer made the @@ -12751,9 +12770,9 @@ the `\' does not, as shown in *note table-gensub-escapes::. Table 9.4: Escape sequence processing for `gensub()' - Because of the complexity of the lexical and runtime level processing -and the special cases for `sub()' and `gsub()', we recommend the use of -`gawk' and `gensub()' when you have to do substitutions. + Because of the complexity of the lexical- and runtime-level +processing and the special cases for `sub()' and `gsub()', we recommend +the use of `gawk' and `gensub()' when you have to do substitutions. ---------- Footnotes ---------- @@ -12780,10 +12799,10 @@ parameters are enclosed in square brackets ([ ]): When closing a coprocess, it is occasionally useful to first close one end of the two-way pipe and then to close the other. This is done by providing a second argument to `close()'. This second - argument should be one of the two string values `"to"' or `"from"', - indicating which end of the pipe to close. Case in the string does - not matter. *Note Two-way I/O::, which discusses this feature in - more detail and gives an example. + argument (HOW) should be one of the two string values `"to"' or + `"from"', indicating which end of the pipe to close. Case in the + string does not matter. *Note Two-way I/O::, which discusses this + feature in more detail and gives an example. Note that the second argument to `close()' is a `gawk' extension; it is not available in compatibility mode (*note Options::). @@ -12801,7 +12820,7 @@ parameters are enclosed in square brackets ([ ]): sometimes it is necessary to force a program to "flush" its buffers (i.e., write the information to its destination, even if a buffer is not full). This is the purpose of the `fflush()' - function--`gawk' also buffers its output and the `fflush()' + function--`gawk' also buffers its output, and the `fflush()' function forces `gawk' to flush its buffers. Brian Kernighan added `fflush()' to his `awk' in April 1992. For @@ -12818,16 +12837,17 @@ parameters are enclosed in square brackets ([ ]): output files and pipes if the argument was the null string. This was changed in order to be compatible with Brian Kernighan's `awk', in the hope that standardizing this - feature in POSIX would then be easier (which indeed helped). + feature in POSIX would then be easier (which indeed proved to + be the case). With `gawk', you can use `fflush("/dev/stdout")' if you wish to flush only the standard output. `fflush()' returns zero if the buffer is successfully flushed; - otherwise, it returns non-zero. (`gawk' returns -1.) In the case - where all buffers are flushed, the return value is zero only if - all buffers were flushed successfully. Otherwise, it is -1, and - `gawk' warns about the problem FILENAME. + otherwise, it returns a nonzero value. (`gawk' returns -1.) In + the case where all buffers are flushed, the return value is zero + only if all buffers were flushed successfully. Otherwise, it is + -1, and `gawk' warns about the problem FILENAME. `gawk' also issues a warning message if you attempt to flush a file or pipe that was opened for reading (such as with `getline'), @@ -12836,9 +12856,9 @@ parameters are enclosed in square brackets ([ ]): Interactive Versus Noninteractive Buffering - As a side point, buffering issues can be even more confusing, - depending upon whether your program is "interactive" (i.e., - communicating with a user sitting at a keyboard).(1) + As a side point, buffering issues can be even more confusing if + your program is "interactive" (i.e., communicating with a user + sitting at a keyboard).(1) Interactive programs generally "line buffer" their output (i.e., they write out every line). Noninteractive programs wait until @@ -12867,7 +12887,7 @@ parameters are enclosed in square brackets ([ ]): shot. `system(COMMAND)' - Execute the operating-system command COMMAND and then return to + Execute the operating system command COMMAND and then return to the `awk' program. Return COMMAND's exit status. For example, if the following fragment of code is put in your `awk' @@ -12956,14 +12976,14 @@ File: gawk.info, Node: Time Functions, Next: Bitwise Functions, Prev: I/O Fun `awk' programs are commonly used to process log files containing timestamp information, indicating when a particular log record was -written. Many programs log their timestamp in the form returned by the -`time()' system call, which is the number of seconds since a particular -epoch. On POSIX-compliant systems, it is the number of seconds since -1970-01-01 00:00:00 UTC, not counting leap seconds.(1) All known -POSIX-compliant systems support timestamps from 0 through 2^31 - 1, -which is sufficient to represent times through 2038-01-19 03:14:07 UTC. -Many systems support a wider range of timestamps, including negative -timestamps that represent times before the epoch. +written. Many programs log their timestamps in the form returned by +the `time()' system call, which is the number of seconds since a +particular epoch. On POSIX-compliant systems, it is the number of +seconds since 1970-01-01 00:00:00 UTC, not counting leap seconds.(1) +All known POSIX-compliant systems support timestamps from 0 through +2^31 - 1, which is sufficient to represent times through 2038-01-19 +03:14:07 UTC. Many systems support a wider range of timestamps, +including negative timestamps that represent times before the epoch. In order to make it easier to process such log files and to produce useful reports, `gawk' provides the following functions for working @@ -12986,9 +13006,9 @@ enclosed in square brackets ([ ]): specified; for example, an hour of -1 means 1 hour before midnight. The origin-zero Gregorian calendar is assumed, with year 0 preceding year 1 and year -1 preceding year 0. The time is - assumed to be in the local timezone. If the daylight-savings flag - is positive, the time is assumed to be daylight savings time; if - zero, the time is assumed to be standard time; and if negative + assumed to be in the local time zone. If the daylight-savings + flag is positive, the time is assumed to be daylight savings time; + if zero, the time is assumed to be standard time; and if negative (the default), `mktime()' attempts to determine whether daylight savings time is in effect for the specified time. @@ -13129,23 +13149,23 @@ the following date format specifications: The weekday as a decimal number (1-7). Monday is day one. `%U' - The week number of the year (the first Sunday as the first day of - week one) as a decimal number (00-53). + The week number of the year (with the first Sunday as the first + day of week one) as a decimal number (00-53). `%V' - The week number of the year (the first Monday as the first day of - week one) as a decimal number (01-53). The method for determining - the week number is as specified by ISO 8601. (To wit: if the week - containing January 1 has four or more days in the new year, then - it is week one; otherwise it is week 53 of the previous year and - the next week is week one.) + The week number of the year (with the first Monday as the first + day of week one) as a decimal number (01-53). The method for + determining the week number is as specified by ISO 8601. (To wit: + if the week containing January 1 has four or more days in the new + year, then it is week one; otherwise it is week 53 of the previous + year and the next week is week one.) `%w' The weekday as a decimal number (0-6). Sunday is day zero. `%W' - The week number of the year (the first Monday as the first day of - week one) as a decimal number (00-53). + The week number of the year (with the first Monday as the first + day of week one) as a decimal number (00-53). `%x' The locale's "appropriate" date representation. (This is `%A %B @@ -13162,8 +13182,8 @@ the following date format specifications: The full year as a decimal number (e.g., 2015). `%z' - The timezone offset in a +HHMM format (e.g., the format necessary - to produce RFC 822/RFC 1036 date headers). + The time zone offset in a `+HHMM' format (e.g., the format + necessary to produce RFC 822/RFC 1036 date headers). `%Z' The time zone name or abbreviation; no characters if no time zone @@ -13280,7 +13300,7 @@ each successive pair of bits in the operands. Three common operations are bitwise AND, OR, and XOR. The operations are described in *note table-bitwise-ops::. - Bit Operator + Bit operator | AND | OR | XOR |--+--+--+--+--+-- Operands | 0 | 1 | 0 | 1 | 0 | 1 @@ -13336,7 +13356,7 @@ paragraph, don't worry about it.) Here is a user-defined function (*note User-defined::) that illustrates the use of these functions: - # bits2str --- turn a byte into readable 1's and 0's + # bits2str --- turn a byte into readable ones and zeros function bits2str(bits, data, mask) { @@ -13394,9 +13414,9 @@ Nondecimal-numbers::), and then demonstrates the results of the ---------- Footnotes ---------- - (1) This example shows that 0's come in on the left side. For + (1) This example shows that zeros come in on the left side. For `gawk', this is always true, but in some languages, it's possible to -have the left side fill with 1's. +have the left side fill with ones. File: gawk.info, Node: Type Functions, Next: I18N Functions, Prev: Bitwise Functions, Up: Built-in @@ -13517,11 +13537,13 @@ the argument names are used to hold the argument values given in the call. A function cannot have two parameters with the same name, nor may it -have a parameter with the same name as the function itself. In -addition, according to the POSIX standard, function parameters cannot -have the same name as one of the special predefined variables (*note -Built-in Variables::). Not all versions of `awk' enforce this -restriction. +have a parameter with the same name as the function itself. + + CAUTION: According to the POSIX standard, function parameters + cannot have the same name as one of the special predefined + variables (*note Built-in Variables::), nor may a function + parameter have the same name as another function. Not all + versions of `awk' enforce these restrictions. Local variables act like the empty string if referenced where a string value is required, and like zero if referenced where a numeric @@ -14123,13 +14145,13 @@ using indirect function calls: # average --- return the average of the values in fields $first - $last - function average(first, last, sum, i) + function average(first, last, the_sum, i) { - sum = 0; + the_sum = 0; for (i = first; i <= last; i++) - sum += $i + the_sum += $i - return sum / (last - first + 1) + return the_sum / (last - first + 1) } # sum --- return the sum of the values in fields $first - $last @@ -20657,8 +20679,8 @@ File: gawk.info, Node: Gawk I18N, Next: I18N Summary, Prev: I18N Example, Up `gawk' itself has been internationalized using the GNU `gettext' package. (GNU `gettext' is described in complete detail in *note (GNU `gettext' utilities)Top:: gettext, GNU gettext tools.) As of this -writing, the latest version of GNU `gettext' is version 0.19.3 -(ftp://ftp.gnu.org/gnu/gettext/gettext-0.19.3.tar.gz). +writing, the latest version of GNU `gettext' is version 0.19.4 +(ftp://ftp.gnu.org/gnu/gettext/gettext-0.19.4.tar.gz). If a translation of `gawk''s messages exists, then `gawk' produces usage messages, warnings, and fatal errors in the local language. @@ -22015,7 +22037,7 @@ so: $ gawk --version -| GNU Awk 4.1.2, API: 1.1 (GNU MPFR 3.1.0-p3, GNU MP 5.0.2) - -| Copyright (C) 1989, 1991-2014 Free Software Foundation. + -| Copyright (C) 1989, 1991-2015 Free Software Foundation. ... (You may see different version numbers than what's shown here. That's @@ -22554,7 +22576,7 @@ set: It's not that well known but it's not that obscure either. It's Euler's modification to Newton's method for calculating pi. Take a look at lines (23) - (25) here: - `http://mathworld.wolfram.com/PiFormulas.htm'. + `http://mathworld.wolfram.com/PiFormulas.html'. The algorithm I wrote simply expands the multiply by 2 and works from the innermost expression outwards. I used this to program HP @@ -28531,7 +28553,7 @@ Unix `awk' git clone git://github.com/onetrueawk/awk bwkawk - This command creates a copy of the Git (http://www.git-scm.com) + This command creates a copy of the Git (http://git-scm.com) repository in a directory named `bwkawk'. If you leave that argument off the `git' command line, the repository copy is created in a directory named `awk'. @@ -28578,7 +28600,7 @@ Unix `awk' To get `awka', go to `http://sourceforge.net/projects/awka'. The project seems to be frozen; no new code changes have been made - since approximately 2003. + since approximately 2001. `pawk' Nelson H.F. Beebe at the University of Utah has modified BWK `awk' @@ -28763,7 +28785,7 @@ released versions of `gawk'. changes, you will probably wish to work with the development version. To do so, you will need to access the `gawk' source code repository. The code is maintained using the Git distributed version control system -(http://git-scm.com/). You will need to install it if your system +(http://git-scm.com). You will need to install it if your system doesn't have it. Once you have done so, use the command: git clone git://git.savannah.gnu.org/gawk.git @@ -28818,7 +28840,7 @@ possible to include them: document describes how GNU software should be written. If you haven't read it, please do so, preferably _before_ starting to modify `gawk'. (The `GNU Coding Standards' are available from the - GNU Project's website (http://www.gnu.org/prep/standards_toc.html). + GNU Project's website (http://www.gnu.org/prep/standards/). Texinfo, Info, and DVI versions are also available.) 5. Use the `gawk' coding style. The C code for `gawk' follows the @@ -29700,6 +29722,21 @@ ANSI C++ programming languages. These standards often become international standards as well. See also "ISO." +Argument + An argument can be two different things. It can be an option or a + file name passed to a command while invoking it from the command + line, or it can be something passed to a "function" inside a + program, e.g. inside `awk'. + + In the latter case, an argument can be passed to a function in two + ways. Either it is given to the called function by value, i.e., a + copy of the value of the variable is made available to the called + function, but the original variable cannot be modified by the + function itself; or it is given by reference, i.e., a pointer to + the interested variable is passed to the function, which can then + directly modify it. In `awk' scalars are passed by value, and + arrays are passed by reference. See "Pass By Value/Reference." + Array A grouping of multiple values under the same name. Most languages just provide sequential arrays. `awk' provides associative arrays. @@ -29735,6 +29772,26 @@ Bash The GNU version of the standard shell (the Bourne-Again SHell). See also "Bourne Shell." +Binary + Base-two notation, where the digits are `0'-`1'. Since electronic + circuitry works "naturally" in base 2 (just think of Off/On), + everything inside a computer is calculated using base 2. Each digit + represents the presence (or absence) of a power of 2 and is called + a "bit". So, for example, the base-two number `10101' is the same + as decimal 21, ((1 x 16) + (1 x 4) + (1 x 1)). + + Since base-two numbers quickly become very long to read and write, + they are usually grouped by 3 (i.e., they are read as octal + numbers), or by 4 (i.e., they are read as hexadecimal numbers). + There is no direct way to insert base 2 numbers in a C program. + If need arises, such numbers are usually inserted as octal or + hexadecimal numbers. The number of base-two digits that fit into + registers used for representing integer numbers in computers is a + rough indication of the computing power of the computer itself. + Most computers nowadays use 64 bits for representing integer + numbers in their registers, but 32-bit, 16-bit and 8-bit registers + have been widely used in the past. *Note Nondecimal-numbers::. + Bit Short for "Binary Digit." All values in computer memory ultimately reduce to binary digits: values that are either zero or @@ -29763,6 +29820,19 @@ Braces The characters `{' and `}'. Braces are used in `awk' for delimiting actions, compound statements, and function bodies. +Bracket Expression + Inside a "regular expression", an expression included in square + brackets, meant to designate a single character as belonging to a + specified character class. A bracket expression can contain a list + of one or more characters, like `[abc]', a range of characters, + like `[A-Z]', or a name, delimited by `:', that designates a known + set of characters, like `[:digit:]'. The form of bracket expression + enclosed between `:' is independent of the underlying + representation of the character themselves, which could utilize + the ASCII, ECBDIC, or Unicode codesets, depending on the + architecture of the computer system, and on localization. See + also "Regular Expression." + Built-in Function The `awk' language provides built-in functions that perform various numerical, I/O-related, and string computations. Examples are @@ -29790,9 +29860,25 @@ C In general, `gawk' attempts to be as similar to the 1990 version of ISO C as makes sense. +C Shell + The C Shell (`csh' or its improved version, `tcsh') is a Unix + shell that was created by Bill Joy in the late 1970s. The C shell + was differentiated from other shells by its interactive features + and overall style, which looks more like C. The C Shell is not + backward compatible with the Bourne Shell, so special attention is + required when converting scripts written for other Unix shells to + the C shell, especially with regard to the management of shell + variables. See also "Bourne Shell." + C++ A popular object-oriented programming language derived from C. +Character Class + See "Bracket Expression." + +Character List + See "Bracket Expression." + Character Set The set of numeric codes used by a computer system to represent the characters (letters, numbers, punctuation, etc.) of a particular @@ -29807,7 +29893,7 @@ CHEM A preprocessor for `pic' that reads descriptions of molecules and produces `pic' input for drawing them. It was written in `awk' by Brian Kernighan and Jon Bentley, and is available from - `http://netlib.sandia.gov/netlib/typesetting/chem.gz'. + `http://netlib.org/typesetting/chem'. Comparison Expression A relation that is either true or false, such as `a < b'. @@ -29820,10 +29906,21 @@ Compiler machine-executable object code. The object code is then executed directly by the computer. See also "Interpreter." +Complemented Bracket Expression + The negation of a "bracket expression". All that is _not_ + described by a given bracket expression. The symbol `^' precedes + the negated bracket expression. E.g.: `[[^:digit:]' designates + whatever character is not a digit. `[^bad]' designates whatever + character is not one of the letters `b', `a', or `d'. See + "Bracket Expression." + Compound Statement A series of `awk' statements, enclosed in curly braces. Compound statements may be nested. (*Note Statements::.) +Computed Regexps + See "Dynamic Regular Expressions." + Concatenation Concatenating two strings means sticking them together, one after another, producing a new string. For example, the string `foo' @@ -29837,6 +29934,12 @@ Conditional Expression otherwise the value is EXPR3. In either case, only one of EXPR2 and EXPR3 is evaluated. (*Note Conditional Exp::.) +Control Statement + A control statement is an instruction to perform a given operation + or a set of operations inside an `awk' program, if a given + condition is true. Control statements are: `if', `for', `while', + and `do' (*note Statements::). + Cookie A peculiar goodie, token, saying or remembrance produced by or presented to a program. (With thanks to Professor Doug McIlroy.) @@ -29943,6 +30046,12 @@ Format are controlled by the format strings contained in the predefined variables `CONVFMT' and `OFMT'. (*Note Control Letters::.) +Fortran + Shorthand for FORmula TRANslator, one of the first programming + languages available for scientific calculations. It was created by + John Backus, and has been available since 1957. It is still in use + today. + Free Documentation License This document describes the terms under which this Info file is published and may be copied. (*Note GNU Free Documentation @@ -29958,9 +30067,16 @@ FSF See "Free Software Foundation." Function - A specialized group of statements used to encapsulate general or - program-specific tasks. `awk' has a number of built-in functions, - and also allows you to define your own. (*Note Functions::.) + A part of an `awk' program that can be invoked from every point of + the program, to perform a task. `awk' has several built-in + functions. Users can define their own functions in every part of + the program. Function can be recursive, i.e., they may invoke + themselves. *Note Functions::. In `gawk' it is also possible to + have functions shared among different programs, and included where + required using the `@include' directive (*note Include Files::). + In `gawk' the name of the function that should be invoked can be + generated at run time, i.e., dynamically. The `gawk' extension + API provides constructor functions (*note Constructor Functions::). `gawk' The GNU implementation of `awk'. @@ -30056,6 +30172,12 @@ Keyword `else', `exit', `for...in', `for', `function', `func', `if', `next', `nextfile', `switch', and `while'. +Korn Shell + The Korn Shell (`ksh') is a Unix shell which was developed by + David Korn at Bell Laboratories in the early 1980s. The Korn Shell + is backward-compatible with the Bourne shell and includes many + features of the C shell. See also "Bourne Shell." + Lesser General Public License This document describes the terms under which binary library archives or shared objects, and their source code may be @@ -30093,6 +30215,13 @@ Metacharacters Instead, they denote regular expression operations, such as repetition, grouping, or alternation. +Nesting + Nesting is where information is organized in layers, or where + objects contain other similar objects. In `gawk' the `@include' + directive can be nested. The "natural" nesting of arithmetic and + logical operations can be changed using parentheses (*note + Precedence::). + No-op An operation that does nothing. @@ -30112,6 +30241,11 @@ Octal are written in C using a leading `0', to indicate their base. Thus, `013' is 11 ((1 x 8) + 3). *Note Nondecimal-numbers::. +Output Record + A single chunk of data that is written out by `awk'. Usually, an + `awk' output record consists of one or more lines of text. *Note + Records::. + Pattern Patterns tell `awk' which input records are interesting to which rules. @@ -30127,6 +30261,9 @@ PEBKAC computer usage problems. (Problem Exists Between Keyboard And Chair.) +Plug-in + See "Extensions." + POSIX The name for a series of standards that specify a Portable Operating System interface. The "IX" denotes the Unix heritage of @@ -30150,6 +30287,9 @@ Range (of input lines) can specify ranges of input lines for `awk' to process or it can specify single lines. (*Note Pattern Overview::.) +Record + See "Input record" and "Output record." + Recursion When a function calls itself, either directly or indirectly. If this is clear, stop, and proceed to the next entry. Otherwise, @@ -30166,6 +30306,16 @@ Redirection using the `>', `>>', `|', and `|&' operators. (*Note Getline::, and *note Redirection::.) +Reference Counts + An internal mechanism in `gawk' to minimize the amount of memory + needed to store the value of string variables. If the value + assumed by a variable is used in more than one place, only one + copy of the value itself is kept, and the associated reference + count is increased when the same value is used by an additional + variable, and decresed when the related variable is no longer in + use. When the reference count goes to zero, the memory space used + to store the value of the variable is freed. + Regexp See "Regular Expression." @@ -30184,6 +30334,15 @@ Regular Expression Constant when you write the `awk' program and cannot be changed during its execution. (*Note Regexp Usage::.) +Regular Expression Operators + See "Metacharacters." + +Rounding + Rounding the result of an arithmetic operation can be tricky. + More than one way of rounding exists, and in `gawk' it is possible + to choose which method should be used in a program. *Note Setting + the rounding mode::. + Rule A segment of an `awk' program that specifies how to process single input records. A rule consists of a "pattern" and an "action". @@ -30245,6 +30404,11 @@ Special File handed directly to the underlying operating system--for example, `/dev/stderr'. (*Note Special Files::.) +Statement + An expression inside an `awk' program in the action part of a + pattern-action rule, or inside an `awk' function. A statement can + be a variable assignment, an array operation, a loop, etc. + Stream Editor A program that reads records from an input stream and processes them one or more at a time. This is in contrast with batch @@ -30287,10 +30451,15 @@ UTC reference time for day and date calculations. See also "Epoch" and "GMT." +Variable + A name for a value. In `awk', variables may be either scalars or + arrays. + Whitespace A sequence of space, TAB, or newline characters occurring inside an input record or a string. + File: gawk.info, Node: Copying, Next: GNU Free Documentation License, Prev: Glossary, Up: Top @@ -31523,7 +31692,7 @@ Index * ! (exclamation point), !~ operator <5>: Case-sensitivity. (line 26) * ! (exclamation point), !~ operator <6>: Computed Regexps. (line 6) * ! (exclamation point), !~ operator: Regexp Usage. (line 19) -* " (double quote), in regexp constants: Computed Regexps. (line 29) +* " (double quote), in regexp constants: Computed Regexps. (line 30) * " (double quote), in shell commands: Quoting. (line 54) * # (number sign), #! (executable scripts): Executable Scripts. (line 6) @@ -31552,7 +31721,7 @@ Index * * (asterisk), * operator, as regexp operator: Regexp Operators. (line 89) * * (asterisk), * operator, null strings, matching: String Functions. - (line 536) + (line 537) * * (asterisk), ** operator <1>: Precedence. (line 49) * * (asterisk), ** operator: Arithmetic Ops. (line 81) * * (asterisk), **= operator <1>: Precedence. (line 95) @@ -31611,7 +31780,7 @@ Index * --re-interval option: Options. (line 279) * --sandbox option: Options. (line 286) * --sandbox option, disabling system() function: I/O Functions. - (line 128) + (line 129) * --sandbox option, input redirection with getline: Getline. (line 19) * --sandbox option, output redirection with print, printf: Redirection. (line 6) @@ -31758,7 +31927,7 @@ Index * \ (backslash), in escape sequences: Escape Sequences. (line 6) * \ (backslash), in escape sequences, POSIX and: Escape Sequences. (line 108) -* \ (backslash), in regexp constants: Computed Regexps. (line 29) +* \ (backslash), in regexp constants: Computed Regexps. (line 30) * \ (backslash), in shell commands: Quoting. (line 48) * \ (backslash), regexp operator: Regexp Operators. (line 18) * ^ (caret), ^ operator: Precedence. (line 49) @@ -31852,7 +32021,7 @@ Index * arrays: Arrays. (line 6) * arrays of arrays: Arrays of Arrays. (line 6) * arrays, an example of using: Array Example. (line 6) -* arrays, and IGNORECASE variable: Array Intro. (line 94) +* arrays, and IGNORECASE variable: Array Intro. (line 100) * arrays, as parameters to functions: Pass By Value/Reference. (line 44) * arrays, associative: Array Intro. (line 50) @@ -31879,14 +32048,14 @@ Index (line 6) * arrays, sorting, and IGNORECASE variable: Array Sorting Functions. (line 83) -* arrays, sparse: Array Intro. (line 72) +* arrays, sparse: Array Intro. (line 76) * arrays, subscripts, uninitialized variables as: Uninitialized Subscripts. (line 6) * arrays, unassigned elements: Reference to Elements. (line 18) * artificial intelligence, gawk and: Distribution contents. (line 52) -* ASCII <1>: Glossary. (line 133) +* ASCII <1>: Glossary. (line 197) * ASCII: Ordinal Functions. (line 45) * asort <1>: Array Sorting Functions. (line 6) @@ -31913,7 +32082,7 @@ Index * asterisk (*), * operator, as regexp operator: Regexp Operators. (line 89) * asterisk (*), * operator, null strings, matching: String Functions. - (line 536) + (line 537) * asterisk (*), ** operator <1>: Precedence. (line 49) * asterisk (*), ** operator: Arithmetic Ops. (line 81) * asterisk (*), **= operator <1>: Precedence. (line 95) @@ -32027,7 +32196,7 @@ Index * backslash (\), in escape sequences: Escape Sequences. (line 6) * backslash (\), in escape sequences, POSIX and: Escape Sequences. (line 108) -* backslash (\), in regexp constants: Computed Regexps. (line 29) +* backslash (\), in regexp constants: Computed Regexps. (line 30) * backslash (\), in shell commands: Quoting. (line 48) * backslash (\), regexp operator: Regexp Operators. (line 18) * backtrace debugger command: Execution Stack. (line 13) @@ -32058,7 +32227,7 @@ Index * BEGINFILE pattern, Boolean patterns and: Expression Patterns. (line 69) * beginfile() user-defined function: Filetrans Function. (line 61) -* Bentley, Jon: Glossary. (line 143) +* Bentley, Jon: Glossary. (line 207) * Benzinger, Michael: Contributors. (line 97) * Berry, Karl <1>: Ranges and Locales. (line 74) * Berry, Karl: Acknowledgments. (line 33) @@ -32120,7 +32289,7 @@ Index * Brennan, Michael: Foreword3. (line 84) * Brian Kernighan's awk <1>: I/O Functions. (line 43) * Brian Kernighan's awk <2>: Gory Details. (line 19) -* Brian Kernighan's awk <3>: String Functions. (line 492) +* Brian Kernighan's awk <3>: String Functions. (line 493) * Brian Kernighan's awk <4>: Delete. (line 51) * Brian Kernighan's awk <5>: Nextfile Statement. (line 47) * Brian Kernighan's awk <6>: Continue Statement. (line 44) @@ -32140,14 +32309,14 @@ Index * Brink, Jeroen: DOS Quoting. (line 10) * Broder, Alan J.: Contributors. (line 88) * Brown, Martin: Contributors. (line 82) -* BSD-based operating systems: Glossary. (line 611) +* BSD-based operating systems: Glossary. (line 753) * bt debugger command (alias for backtrace): Execution Stack. (line 13) * Buening, Andreas <1>: Bugs. (line 70) * Buening, Andreas <2>: Contributors. (line 92) * Buening, Andreas: Acknowledgments. (line 60) * buffering, input/output <1>: Two-way I/O. (line 52) -* buffering, input/output: I/O Functions. (line 140) -* buffering, interactive vs. noninteractive: I/O Functions. (line 75) +* buffering, input/output: I/O Functions. (line 141) +* buffering, interactive vs. noninteractive: I/O Functions. (line 76) * buffers, flushing: I/O Functions. (line 32) * buffers, operators for: GNU Regexp Operators. (line 48) @@ -32172,8 +32341,8 @@ Index * case keyword: Switch Statement. (line 6) * case sensitivity, and regexps: User-modified. (line 76) * case sensitivity, and string comparisons: User-modified. (line 76) -* case sensitivity, array indices and: Array Intro. (line 94) -* case sensitivity, converting case: String Functions. (line 522) +* case sensitivity, array indices and: Array Intro. (line 100) +* case sensitivity, converting case: String Functions. (line 523) * case sensitivity, example programs: Library Functions. (line 53) * case sensitivity, gawk: Case-sensitivity. (line 26) * case sensitivity, regexps and: Case-sensitivity. (line 6) @@ -32182,7 +32351,7 @@ Index (line 56) * character lists in regular expression: Bracket Expressions. (line 6) * character lists, See bracket expressions: Regexp Operators. (line 56) -* character sets (machine character encodings) <1>: Glossary. (line 133) +* character sets (machine character encodings) <1>: Glossary. (line 197) * character sets (machine character encodings): Ordinal Functions. (line 45) * character sets, See Also bracket expressions: Regexp Operators. @@ -32193,7 +32362,7 @@ Index * Chassell, Robert J.: Acknowledgments. (line 33) * chdir() extension function: Extension Sample File Functions. (line 12) -* chem utility: Glossary. (line 143) +* chem utility: Glossary. (line 207) * chr() extension function: Extension Sample Ord. (line 15) * chr() user-defined function: Ordinal Functions. (line 16) @@ -32251,7 +32420,7 @@ Index * common extensions, \x escape sequence: Escape Sequences. (line 61) * common extensions, BINMODE variable: PC Using. (line 33) * common extensions, delete to delete entire arrays: Delete. (line 39) -* common extensions, func keyword: Definition Syntax. (line 93) +* common extensions, func keyword: Definition Syntax. (line 95) * common extensions, length() applied to an array: String Functions. (line 201) * common extensions, RS as a regexp: gawk split records. (line 6) @@ -32270,7 +32439,7 @@ Index * compatibility mode (gawk), octal numbers: Nondecimal-numbers. (line 60) * compatibility mode (gawk), specifying: Options. (line 81) -* compiled programs <1>: Glossary. (line 155) +* compiled programs <1>: Glossary. (line 219) * compiled programs: Basic High Level. (line 15) * compiling gawk for Cygwin: Cygwin. (line 6) * compiling gawk for MS-DOS and MS-Windows: PC Compiling. (line 13) @@ -32302,9 +32471,9 @@ Index * control statements: Statements. (line 6) * controlling array scanning order: Controlling Scanning. (line 14) -* convert string to lower case: String Functions. (line 523) -* convert string to number: String Functions. (line 390) -* convert string to upper case: String Functions. (line 529) +* convert string to lower case: String Functions. (line 524) +* convert string to number: String Functions. (line 391) +* convert string to upper case: String Functions. (line 530) * converting integer array subscripts: Numeric Array Subscripts. (line 31) * converting, dates to timestamps: Time Functions. (line 76) @@ -32316,7 +32485,7 @@ Index * CONVFMT variable: Strings And Numbers. (line 29) * CONVFMT variable, and array subscripts: Numeric Array Subscripts. (line 6) -* cookie: Glossary. (line 177) +* cookie: Glossary. (line 258) * coprocesses <1>: Two-way I/O. (line 25) * coprocesses: Redirection. (line 96) * coprocesses, closing: Close Files And Pipes. @@ -32340,7 +32509,7 @@ Index * cut.awk program: Cut Program. (line 45) * d debugger command (alias for delete): Breakpoint Control. (line 64) * d.c., See dark corner: Conventions. (line 42) -* dark corner <1>: Glossary. (line 188) +* dark corner <1>: Glossary. (line 269) * dark corner: Conventions. (line 42) * dark corner, "0" is actually true: Truth Values. (line 24) * dark corner, /= operator vs. /=.../ regexp constant: Assignment Ops. @@ -32382,7 +32551,7 @@ Index (line 148) * dark corner, regexp constants, as arguments to user-defined functions: Using Constant Regexps. (line 43) -* dark corner, split() function: String Functions. (line 361) +* dark corner, split() function: String Functions. (line 362) * dark corner, strings, storing: gawk split records. (line 83) * dark corner, value of ARGV[0]: Auto-set. (line 39) * data, fixed-width: Constant Size. (line 6) @@ -32601,7 +32770,7 @@ Index (line 77) * differences in awk and gawk, SYMTAB variable: Auto-set. (line 296) * differences in awk and gawk, TEXTDOMAIN variable: User-modified. - (line 151) + (line 152) * differences in awk and gawk, trunc-mod operation: Arithmetic Ops. (line 66) * directories, command-line: Command-line directories. @@ -32627,7 +32796,7 @@ Index * dollar sign ($), incrementing fields and arrays: Increment Ops. (line 30) * dollar sign ($), regexp operator: Regexp Operators. (line 35) -* double quote ("), in regexp constants: Computed Regexps. (line 29) +* double quote ("), in regexp constants: Computed Regexps. (line 30) * double quote ("), in shell commands: Quoting. (line 54) * down debugger command: Execution Stack. (line 23) * Drepper, Ulrich: Acknowledgments. (line 52) @@ -32689,7 +32858,7 @@ Index * environment variables used by gawk: Environment Variables. (line 6) * environment variables, in ENVIRON array: Auto-set. (line 60) -* epoch, definition of: Glossary. (line 234) +* epoch, definition of: Glossary. (line 315) * equals sign (=), = operator: Assignment Ops. (line 6) * equals sign (=), == operator <1>: Precedence. (line 65) * equals sign (=), == operator: Comparison Operators. @@ -32775,7 +32944,7 @@ Index * extensions, common, BINMODE variable: PC Using. (line 33) * extensions, common, delete to delete entire arrays: Delete. (line 39) * extensions, common, fflush() function: I/O Functions. (line 43) -* extensions, common, func keyword: Definition Syntax. (line 93) +* extensions, common, func keyword: Definition Syntax. (line 95) * extensions, common, length() applied to an array: String Functions. (line 201) * extensions, common, RS as a regexp: gawk split records. (line 6) @@ -32921,7 +33090,7 @@ Index * format time string: Time Functions. (line 48) * formats, numeric output: OFMT. (line 6) * formatting output: Printf. (line 6) -* formatting strings: String Functions. (line 383) +* formatting strings: String Functions. (line 384) * forward slash (/) to enclose regular expressions: Regexp. (line 10) * forward slash (/), / operator: Precedence. (line 55) * forward slash (/), /= operator <1>: Precedence. (line 95) @@ -32935,10 +33104,10 @@ Index * frame debugger command: Execution Stack. (line 27) * Free Documentation License (FDL): GNU Free Documentation License. (line 7) -* Free Software Foundation (FSF) <1>: Glossary. (line 288) +* Free Software Foundation (FSF) <1>: Glossary. (line 375) * Free Software Foundation (FSF) <2>: Getting. (line 10) * Free Software Foundation (FSF): Manual History. (line 6) -* FreeBSD: Glossary. (line 611) +* FreeBSD: Glossary. (line 753) * FS variable <1>: User-modified. (line 50) * FS variable: Field Separators. (line 15) * FS variable, --field-separator option and: Options. (line 21) @@ -32952,7 +33121,7 @@ Index * FS, containing ^: Regexp Field Splitting. (line 59) * FS, in multiline records: Multiple Line. (line 41) -* FSF (Free Software Foundation) <1>: Glossary. (line 288) +* FSF (Free Software Foundation) <1>: Glossary. (line 375) * FSF (Free Software Foundation) <2>: Getting. (line 10) * FSF (Free Software Foundation): Manual History. (line 6) * fts() extension function: Extension Sample File Functions. @@ -32992,7 +33161,7 @@ Index * functions, library, user database, reading: Passwd Functions. (line 6) * functions, names of: Definition Syntax. (line 23) -* functions, recursive: Definition Syntax. (line 83) +* functions, recursive: Definition Syntax. (line 85) * functions, string-translation: I18N Functions. (line 6) * functions, undefined: Pass By Value/Reference. (line 68) @@ -33013,7 +33182,7 @@ Index * gawk, awk and: Preface. (line 21) * gawk, bitwise operations in: Bitwise Functions. (line 40) * gawk, break statement in: Break Statement. (line 51) -* gawk, character classes and: Bracket Expressions. (line 100) +* gawk, character classes and: Bracket Expressions. (line 101) * gawk, coding style in: Adding Code. (line 38) * gawk, command-line options, and regular expressions: GNU Regexp Operators. (line 70) @@ -33048,7 +33217,7 @@ Index * gawk, IGNORECASE variable in <1>: Array Sorting Functions. (line 83) * gawk, IGNORECASE variable in <2>: String Functions. (line 58) -* gawk, IGNORECASE variable in <3>: Array Intro. (line 94) +* gawk, IGNORECASE variable in <3>: Array Intro. (line 100) * gawk, IGNORECASE variable in <4>: User-modified. (line 76) * gawk, IGNORECASE variable in: Case-sensitivity. (line 26) * gawk, implementation issues: Notes. (line 6) @@ -33090,7 +33259,7 @@ Index * gawk, splitting fields and: Constant Size. (line 87) * gawk, string-translation functions: I18N Functions. (line 6) * gawk, SYMTAB array in: Auto-set. (line 296) -* gawk, TEXTDOMAIN variable in: User-modified. (line 151) +* gawk, TEXTDOMAIN variable in: User-modified. (line 152) * gawk, timestamps: Time Functions. (line 6) * gawk, uses for: Preface. (line 34) * gawk, versions of, information about, printing: Options. (line 300) @@ -33105,7 +33274,7 @@ Index * gawkpath_append shell function: Shell Startup Files. (line 19) * gawkpath_default shell function: Shell Startup Files. (line 12) * gawkpath_prepend shell function: Shell Startup Files. (line 15) -* General Public License (GPL): Glossary. (line 305) +* General Public License (GPL): Glossary. (line 399) * General Public License, See GPL: Manual History. (line 11) * generate time values: Time Functions. (line 25) * gensub <1>: String Functions. (line 90) @@ -33137,7 +33306,7 @@ Index * getline from a file: Getline/File. (line 6) * getline into a variable: Getline/Variable. (line 6) * getline statement, BEGINFILE/ENDFILE patterns and: BEGINFILE/ENDFILE. - (line 54) + (line 53) * getlocaltime() user-defined function: Getlocaltime Function. (line 16) * getopt() function (C library): Getopt Function. (line 15) @@ -33163,18 +33332,18 @@ Index * GNU awk, See gawk: Preface. (line 51) * GNU Free Documentation License: GNU Free Documentation License. (line 7) -* GNU General Public License: Glossary. (line 305) -* GNU Lesser General Public License: Glossary. (line 396) +* GNU General Public License: Glossary. (line 399) +* GNU Lesser General Public License: Glossary. (line 496) * GNU long options <1>: Options. (line 6) * GNU long options: Command Line. (line 13) * GNU long options, printing list of: Options. (line 154) -* GNU Project <1>: Glossary. (line 314) +* GNU Project <1>: Glossary. (line 408) * GNU Project: Manual History. (line 11) -* GNU/Linux <1>: Glossary. (line 611) +* GNU/Linux <1>: Glossary. (line 753) * GNU/Linux <2>: I18N Example. (line 55) * GNU/Linux: Manual History. (line 28) * Gordon, Assaf: Contributors. (line 105) -* GPL (General Public License) <1>: Glossary. (line 305) +* GPL (General Public License) <1>: Glossary. (line 399) * GPL (General Public License): Manual History. (line 11) * GPL (General Public License), printing: Options. (line 88) * grcat program: Group Functions. (line 16) @@ -33186,7 +33355,7 @@ Index * gsub <1>: String Functions. (line 140) * gsub: Using Constant Regexps. (line 43) -* gsub() function, arguments of: String Functions. (line 462) +* gsub() function, arguments of: String Functions. (line 463) * gsub() function, escape processing: Gory Details. (line 6) * h debugger command (alias for help): Miscellaneous Debugger Commands. (line 66) @@ -33221,7 +33390,7 @@ Index * ignore breakpoint: Breakpoint Control. (line 87) * ignore debugger command: Breakpoint Control. (line 87) * IGNORECASE variable: User-modified. (line 76) -* IGNORECASE variable, and array indices: Array Intro. (line 94) +* IGNORECASE variable, and array indices: Array Intro. (line 100) * IGNORECASE variable, and array sorting functions: Array Sorting Functions. (line 83) * IGNORECASE variable, in example programs: Library Functions. @@ -33289,14 +33458,14 @@ Index * integers, arbitrary precision: Arbitrary Precision Integers. (line 6) * integers, unsigned: Computer Arithmetic. (line 41) -* interacting with other programs: I/O Functions. (line 106) +* interacting with other programs: I/O Functions. (line 107) * internationalization <1>: I18N and L10N. (line 6) * internationalization: I18N Functions. (line 6) * internationalization, localization <1>: Internationalization. (line 13) -* internationalization, localization: User-modified. (line 151) +* internationalization, localization: User-modified. (line 152) * internationalization, localization, character classes: Bracket Expressions. - (line 100) + (line 101) * internationalization, localization, gawk and: Internationalization. (line 13) * internationalization, localization, locale categories: Explaining gettext. @@ -33306,20 +33475,20 @@ Index * internationalization, localization, portability and: I18N Portability. (line 6) * internationalizing a program: Explaining gettext. (line 6) -* interpreted programs <1>: Glossary. (line 356) +* interpreted programs <1>: Glossary. (line 450) * interpreted programs: Basic High Level. (line 15) * interval expressions, regexp operator: Regexp Operators. (line 116) * inventory-shipped file: Sample Data Files. (line 32) -* invoke shell command: I/O Functions. (line 106) +* invoke shell command: I/O Functions. (line 107) * isarray: Type Functions. (line 11) -* ISO: Glossary. (line 367) -* ISO 8859-1: Glossary. (line 133) -* ISO Latin-1: Glossary. (line 133) +* ISO: Glossary. (line 461) +* ISO 8859-1: Glossary. (line 197) +* ISO Latin-1: Glossary. (line 197) * Jacobs, Andrew: Passwd Functions. (line 90) * Jaegermann, Michal <1>: Contributors. (line 45) * Jaegermann, Michal: Acknowledgments. (line 60) * Java implementation of awk: Other Versions. (line 117) -* Java programming language: Glossary. (line 379) +* Java programming language: Glossary. (line 473) * jawk: Other Versions. (line 117) * Jedi knights: Undocumented. (line 6) * Johansen, Chris: Signature Program. (line 25) @@ -33328,7 +33497,7 @@ Index * Kahrs, Ju"rgen: Acknowledgments. (line 60) * Kasal, Stepan: Acknowledgments. (line 60) * Kenobi, Obi-Wan: Undocumented. (line 6) -* Kernighan, Brian <1>: Glossary. (line 143) +* Kernighan, Brian <1>: Glossary. (line 207) * Kernighan, Brian <2>: Basic Data Typing. (line 54) * Kernighan, Brian <3>: Other Versions. (line 13) * Kernighan, Brian <4>: Contributors. (line 11) @@ -33369,8 +33538,8 @@ Index * length: String Functions. (line 171) * length of input record: String Functions. (line 178) * length of string: String Functions. (line 171) -* Lesser General Public License (LGPL): Glossary. (line 396) -* LGPL (Lesser General Public License): Glossary. (line 396) +* Lesser General Public License (LGPL): Glossary. (line 496) +* LGPL (Lesser General Public License): Glossary. (line 496) * libmawk: Other Versions. (line 125) * libraries of awk functions: Library Functions. (line 6) * libraries of awk functions, assertions: Assert Function. (line 6) @@ -33415,7 +33584,7 @@ Index * lint checking, undefined functions: Pass By Value/Reference. (line 85) * LINT variable: User-modified. (line 88) -* Linux <1>: Glossary. (line 611) +* Linux <1>: Glossary. (line 753) * Linux <2>: I18N Example. (line 55) * Linux: Manual History. (line 28) * list all global variables, in debugger: Debugger Info. (line 48) @@ -33470,14 +33639,14 @@ Index * matching, expressions, See comparison expressions: Typing and Comparison. (line 9) * matching, leftmost longest: Multiple Line. (line 26) -* matching, null strings: String Functions. (line 536) +* matching, null strings: String Functions. (line 537) * mawk utility <1>: Other Versions. (line 48) * 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 120) * maximum precision supported by MPFR library: Auto-set. (line 244) -* McIlroy, Doug: Glossary. (line 177) +* McIlroy, Doug: Glossary. (line 258) * McPhee, Patrick: Contributors. (line 100) * message object files: Explaining gettext. (line 42) * message object files, converting from portable object files: I18N Example. @@ -33505,7 +33674,7 @@ Index * names, functions: Definition Syntax. (line 23) * namespace issues: Library Names. (line 6) * namespace issues, functions: Definition Syntax. (line 23) -* NetBSD: Glossary. (line 611) +* NetBSD: Glossary. (line 753) * networks, programming: TCP/IP Networking. (line 6) * networks, support for: Special Network. (line 6) * newlines <1>: Boolean Ops. (line 69) @@ -33514,8 +33683,8 @@ Index * newlines, as field separators: Default Field Splitting. (line 6) * newlines, as record separators: awk split records. (line 12) -* newlines, in dynamic regexps: Computed Regexps. (line 59) -* newlines, in regexp constants: Computed Regexps. (line 69) +* newlines, in dynamic regexps: Computed Regexps. (line 60) +* newlines, in regexp constants: Computed Regexps. (line 70) * newlines, printing: Print Examples. (line 12) * newlines, separating statements in actions <1>: Statements. (line 10) * newlines, separating statements in actions: Action Overview. @@ -33561,7 +33730,7 @@ Index (line 43) * null strings, converting numbers to strings: Strings And Numbers. (line 21) -* null strings, matching: String Functions. (line 536) +* null strings, matching: String Functions. (line 537) * number as string of bits: Bitwise Functions. (line 110) * number of array elements: String Functions. (line 201) * number sign (#), #! (executable scripts): Executable Scripts. @@ -33590,10 +33759,10 @@ Index * OFMT variable <2>: Strings And Numbers. (line 57) * OFMT variable: OFMT. (line 15) * OFMT variable, POSIX awk and: OFMT. (line 27) -* OFS variable <1>: User-modified. (line 113) +* OFS variable <1>: User-modified. (line 114) * OFS variable <2>: Output Separators. (line 6) * OFS variable: Changing Fields. (line 64) -* OpenBSD: Glossary. (line 611) +* OpenBSD: Glossary. (line 753) * OpenSolaris: Other Versions. (line 100) * operating systems, BSD-based: Manual History. (line 28) * operating systems, PC, gawk on: PC Using. (line 6) @@ -33643,7 +33812,7 @@ Index (line 12) * ord() user-defined function: Ordinal Functions. (line 16) * order of evaluation, concatenation: Concatenation. (line 41) -* ORS variable <1>: User-modified. (line 118) +* ORS variable <1>: User-modified. (line 119) * ORS variable: Output Separators. (line 21) * output field separator, See OFS variable: Changing Fields. (line 64) * output record separator, See ORS variable: Output Separators. @@ -33719,7 +33888,7 @@ Index (line 65) * portability, deleting array elements: Delete. (line 56) * portability, example programs: Library Functions. (line 42) -* portability, functions, defining: Definition Syntax. (line 109) +* portability, functions, defining: Definition Syntax. (line 111) * portability, gawk: New Ports. (line 6) * portability, gettext library and: Explaining gettext. (line 11) * portability, internationalization and: I18N Portability. (line 6) @@ -33731,7 +33900,7 @@ Index * portability, operators: Increment Ops. (line 60) * portability, operators, not in POSIX awk: Precedence. (line 98) * portability, POSIXLY_CORRECT environment variable: Options. (line 359) -* portability, substr() function: String Functions. (line 512) +* portability, substr() function: String Functions. (line 513) * portable object files <1>: Translator i18n. (line 6) * portable object files: Explaining gettext. (line 37) * portable object files, converting to message object files: I18N Example. @@ -33764,7 +33933,7 @@ Index * POSIX awk, field separators and <1>: Full Line Fields. (line 16) * POSIX awk, field separators and: Fields. (line 6) * POSIX awk, FS variable and: User-modified. (line 60) -* POSIX awk, function keyword in: Definition Syntax. (line 93) +* POSIX awk, function keyword in: Definition Syntax. (line 95) * POSIX awk, functions and, gsub()/sub(): Gory Details. (line 90) * POSIX awk, functions and, length(): String Functions. (line 180) * POSIX awk, GNU long options and: Options. (line 15) @@ -33783,7 +33952,7 @@ Index * POSIX, gawk extensions not included in: POSIX/GNU. (line 6) * POSIX, programs, implementing in awk: Clones. (line 6) * POSIXLY_CORRECT environment variable: Options. (line 339) -* PREC variable: User-modified. (line 123) +* PREC variable: User-modified. (line 124) * precedence <1>: Precedence. (line 6) * precedence: Increment Ops. (line 60) * precedence, regexp operators: Regexp Operators. (line 156) @@ -33798,7 +33967,7 @@ Index * print statement, commas, omitting: Print Examples. (line 31) * print statement, I/O operators in: Precedence. (line 71) * print statement, line continuations and: Print Examples. (line 76) -* print statement, OFMT variable and: User-modified. (line 113) +* print statement, OFMT variable and: User-modified. (line 114) * print statement, See Also redirection, of output: Redirection. (line 17) * print statement, sprintf() function and: Round Function. (line 6) @@ -33857,7 +34026,7 @@ Index * programming conventions, functions, calling: Calling Built-in. (line 10) * programming conventions, functions, writing: Definition Syntax. - (line 65) + (line 67) * programming conventions, gawk extensions: Internal File Ops. (line 45) * programming conventions, private variable names: Library Names. @@ -33866,7 +34035,7 @@ Index * programming languages, Ada: Glossary. (line 11) * programming languages, data-driven vs. procedural: Getting Started. (line 12) -* programming languages, Java: Glossary. (line 379) +* programming languages, Java: Glossary. (line 473) * programming, basic steps: Basic High Level. (line 20) * programming, concepts: Basic Concepts. (line 6) * pwcat program: Passwd Functions. (line 23) @@ -33913,7 +34082,7 @@ Index * readfile() user-defined function: Readfile Function. (line 30) * reading input files: Reading Files. (line 6) * recipe for a programming language: History. (line 6) -* record separators <1>: User-modified. (line 132) +* record separators <1>: User-modified. (line 133) * record separators: awk split records. (line 6) * record separators, changing: awk split records. (line 85) * record separators, regular expressions as: awk split records. @@ -33926,7 +34095,7 @@ Index * records, splitting input into: Records. (line 6) * records, terminating: awk split records. (line 125) * records, treating files as: gawk split records. (line 93) -* recursive functions: Definition Syntax. (line 83) +* recursive functions: Definition Syntax. (line 85) * redirect gawk output, in debugger: Debugger Info. (line 72) * redirection of input: Getline/File. (line 6) * redirection of output: Redirection. (line 6) @@ -33941,8 +34110,8 @@ Index * regexp constants, as patterns: Expression Patterns. (line 34) * regexp constants, in gawk: Using Constant Regexps. (line 28) -* regexp constants, slashes vs. quotes: Computed Regexps. (line 29) -* regexp constants, vs. string constants: Computed Regexps. (line 39) +* regexp constants, slashes vs. quotes: Computed Regexps. (line 30) +* regexp constants, vs. string constants: Computed Regexps. (line 40) * register extension: Registration Functions. (line 6) * regular expressions: Regexp. (line 6) @@ -33961,7 +34130,7 @@ Index (line 57) * regular expressions, dynamic: Computed Regexps. (line 6) * regular expressions, dynamic, with embedded newlines: Computed Regexps. - (line 59) + (line 60) * regular expressions, gawk, command-line options: GNU Regexp Operators. (line 70) * regular expressions, interval expressions and: Options. (line 279) @@ -33980,7 +34149,7 @@ Index * regular expressions, searching for: Egrep Program. (line 6) * relational operators, See comparison operators: Typing and Comparison. (line 9) -* replace in string: String Functions. (line 408) +* replace in string: String Functions. (line 409) * retrying input: Retrying Input. (line 6) * return debugger command: Debugger Execution Control. (line 54) @@ -34026,8 +34195,8 @@ Index * round to nearest integer: Numeric Functions. (line 38) * round() user-defined function: Round Function. (line 16) * rounding numbers: Round Function. (line 6) -* ROUNDMODE variable: User-modified. (line 127) -* RS variable <1>: User-modified. (line 132) +* ROUNDMODE variable: User-modified. (line 128) +* RS variable <1>: User-modified. (line 133) * RS variable: awk split records. (line 12) * RS variable, multiline records and: Multiple Line. (line 17) * rshift: Bitwise Functions. (line 53) @@ -34084,19 +34253,19 @@ Index * separators, field, FIELDWIDTHS variable and: User-modified. (line 37) * separators, field, FPAT variable and: User-modified. (line 43) * separators, field, POSIX and: Fields. (line 6) -* separators, for records <1>: User-modified. (line 132) +* separators, for records <1>: User-modified. (line 133) * separators, for records: awk split records. (line 6) * separators, for records, regular expressions as: awk split records. (line 125) * separators, for statements in actions: Action Overview. (line 19) -* separators, subscript: User-modified. (line 145) +* separators, subscript: User-modified. (line 146) * set breakpoint: Breakpoint Control. (line 11) * set debugger command: Viewing And Changing Data. (line 59) * set directory of message catalogs: I18N Functions. (line 12) * set watchpoint: Viewing And Changing Data. (line 67) -* shadowing of variable values: Definition Syntax. (line 71) +* shadowing of variable values: Definition Syntax. (line 73) * shell quoting, rules for: Quoting. (line 6) * shells, piping commands into: Redirection. (line 136) * shells, quoting: Using Shell Variables. @@ -34138,14 +34307,14 @@ Index (line 14) * sidebar, Changing NR and FNR: Auto-set. (line 339) * sidebar, Controlling Output Buffering with system(): I/O Functions. - (line 138) + (line 139) * sidebar, Escape Sequences for Metacharacters: Escape Sequences. (line 137) * sidebar, FS and IGNORECASE: Field Splitting Summary. (line 38) * sidebar, Interactive Versus Noninteractive Buffering: I/O Functions. - (line 73) -* sidebar, Matching the Null String: String Functions. (line 534) + (line 74) +* sidebar, Matching the Null String: String Functions. (line 535) * sidebar, Operator Evaluation Order: Increment Ops. (line 58) * sidebar, Piping into sh: Redirection. (line 134) * sidebar, Pre-POSIX awk Used OFMT for String Conversion: Strings And Numbers. @@ -34159,7 +34328,7 @@ Index * sidebar, Understanding #!: Executable Scripts. (line 31) * sidebar, Understanding $0: Changing Fields. (line 134) * sidebar, Using \n in Bracket Expressions of Dynamic Regexps: Computed Regexps. - (line 57) + (line 58) * sidebar, Using close()'s Return Value: Close Files And Pipes. (line 131) * SIGHUP signal, for dynamic profiling: Profiling. (line 210) @@ -34212,16 +34381,16 @@ Index * source code, QuikTrim Awk: Other Versions. (line 139) * source code, Solaris awk: Other Versions. (line 100) * source files, search path for: Programs Exercises. (line 70) -* sparse arrays: Array Intro. (line 72) +* sparse arrays: Array Intro. (line 76) * Spencer, Henry: Glossary. (line 16) * split: String Functions. (line 316) * split string into array: String Functions. (line 297) * split utility: Split Program. (line 6) * split() function, array elements, deleting: Delete. (line 61) * split.awk program: Split Program. (line 30) -* sprintf <1>: String Functions. (line 383) +* sprintf <1>: String Functions. (line 384) * sprintf: OFMT. (line 15) -* sprintf() function, OFMT variable and: User-modified. (line 113) +* sprintf() function, OFMT variable and: User-modified. (line 114) * sprintf() function, print/printf statements and: Round Function. (line 6) * sqrt: Numeric Functions. (line 92) @@ -34229,7 +34398,7 @@ Index * square root: Numeric Functions. (line 92) * srand: Numeric Functions. (line 96) * stack frame: Debugging Terms. (line 10) -* Stallman, Richard <1>: Glossary. (line 288) +* Stallman, Richard <1>: Glossary. (line 375) * Stallman, Richard <2>: Contributors. (line 23) * Stallman, Richard <3>: Acknowledgments. (line 18) * Stallman, Richard: Manual History. (line 6) @@ -34253,7 +34422,7 @@ Index * stream editors: Full Line Fields. (line 22) * strftime: Time Functions. (line 48) * string constants: Scalar Constants. (line 15) -* string constants, vs. regexp constants: Computed Regexps. (line 39) +* string constants, vs. regexp constants: Computed Regexps. (line 40) * string extraction (internationalization): String Extraction. (line 6) * string length: String Functions. (line 171) @@ -34265,7 +34434,7 @@ Index * strings splitting, example: String Functions. (line 335) * strings, converting <1>: Bitwise Functions. (line 110) * strings, converting: Strings And Numbers. (line 6) -* strings, converting letter case: String Functions. (line 522) +* strings, converting letter case: String Functions. (line 523) * strings, converting, numbers to: User-modified. (line 30) * strings, empty, See null strings: awk split records. (line 115) * strings, extracting: String Extraction. (line 6) @@ -34275,15 +34444,15 @@ Index * strings, null: Regexp Field Splitting. (line 43) * strings, numeric: Variable Typing. (line 6) -* strtonum: String Functions. (line 390) +* strtonum: String Functions. (line 391) * strtonum() function (gawk), --non-decimal-data option and: Nondecimal Data. (line 35) -* sub <1>: String Functions. (line 408) +* sub <1>: String Functions. (line 409) * sub: Using Constant Regexps. (line 43) -* sub() function, arguments of: String Functions. (line 462) +* sub() function, arguments of: String Functions. (line 463) * sub() function, escape processing: Gory Details. (line 6) -* subscript separators: User-modified. (line 145) +* subscript separators: User-modified. (line 146) * subscripts in arrays, multidimensional: Multidimensional. (line 10) * subscripts in arrays, multidimensional, scanning: Multiscanning. (line 11) @@ -34291,19 +34460,19 @@ Index (line 6) * subscripts in arrays, uninitialized variables as: Uninitialized Subscripts. (line 6) -* SUBSEP variable: User-modified. (line 145) +* SUBSEP variable: User-modified. (line 146) * SUBSEP variable, and multidimensional arrays: Multidimensional. (line 16) * substitute in string: String Functions. (line 90) -* substr: String Functions. (line 481) -* substring: String Functions. (line 481) +* substr: String Functions. (line 482) +* substring: String Functions. (line 482) * Sumner, Andrew: Other Versions. (line 68) * supplementary groups of gawk process: Auto-set. (line 260) * switch statement: Switch Statement. (line 6) * SYMTAB array: Auto-set. (line 296) * syntactic ambiguity: /= operator vs. /=.../ regexp constant: Assignment Ops. (line 148) -* system: I/O Functions. (line 106) +* system: I/O Functions. (line 107) * systime: Time Functions. (line 66) * t debugger command (alias for tbreak): Breakpoint Control. (line 90) * tbreak debugger command: Breakpoint Control. (line 90) @@ -34330,7 +34499,7 @@ Index * text, printing: Print. (line 22) * text, printing, unduplicated lines of: Uniq Program. (line 6) * TEXTDOMAIN variable <1>: Programmer i18n. (line 9) -* TEXTDOMAIN variable: User-modified. (line 151) +* TEXTDOMAIN variable: User-modified. (line 152) * TEXTDOMAIN variable, BEGIN pattern and: Programmer i18n. (line 60) * TEXTDOMAIN variable, portability and: I18N Portability. (line 20) * textdomain() function (C library): Explaining gettext. (line 28) @@ -34353,8 +34522,8 @@ Index * timestamps, converting dates to: Time Functions. (line 76) * timestamps, formatted: Getlocaltime Function. (line 6) -* tolower: String Functions. (line 523) -* toupper: String Functions. (line 529) +* tolower: String Functions. (line 524) +* toupper: String Functions. (line 530) * tr utility: Translate Program. (line 6) * trace debugger command: Miscellaneous Debugger Commands. (line 108) @@ -34373,14 +34542,14 @@ Index (line 22) * troubleshooting, fatal errors, printf format strings: Format Modifiers. (line 158) -* troubleshooting, fflush() function: I/O Functions. (line 62) +* troubleshooting, fflush() function: I/O Functions. (line 63) * troubleshooting, function call syntax: Function Calls. (line 30) * troubleshooting, gawk: Compatibility Mode. (line 6) * troubleshooting, gawk, bug reports: Bugs. (line 9) * troubleshooting, gawk, fatal errors, function arguments: Calling Built-in. (line 16) * troubleshooting, getline function: File Checking. (line 25) -* troubleshooting, gsub()/sub() functions: String Functions. (line 472) +* troubleshooting, gsub()/sub() functions: String Functions. (line 473) * troubleshooting, match() function: String Functions. (line 292) * troubleshooting, print statement, omitting commas: Print Examples. (line 31) @@ -34388,10 +34557,10 @@ Index * troubleshooting, quotes with file names: Special FD. (line 62) * troubleshooting, readable data files: File Checking. (line 6) * troubleshooting, regexp constants vs. string constants: Computed Regexps. - (line 39) + (line 40) * troubleshooting, string concatenation: Concatenation. (line 26) -* troubleshooting, substr() function: String Functions. (line 499) -* troubleshooting, system() function: I/O Functions. (line 128) +* troubleshooting, substr() function: String Functions. (line 500) +* troubleshooting, system() function: I/O Functions. (line 129) * troubleshooting, typographical errors, global variables: Options. (line 98) * true, logical: Truth Values. (line 6) @@ -34414,14 +34583,14 @@ Index * undisplay debugger command: Viewing And Changing Data. (line 80) * undocumented features: Undocumented. (line 6) -* Unicode <1>: Glossary. (line 133) +* Unicode <1>: Glossary. (line 197) * Unicode <2>: Ranges and Locales. (line 61) * Unicode: Ordinal Functions. (line 45) * uninitialized variables, as array subscripts: Uninitialized Subscripts. (line 6) * uniq utility: Uniq Program. (line 6) * uniq.awk program: Uniq Program. (line 65) -* Unix: Glossary. (line 611) +* Unix: Glossary. (line 753) * Unix awk, backslashes in escape sequences: Escape Sequences. (line 120) * Unix awk, close() function and: Close Files And Pipes. @@ -34470,7 +34639,7 @@ Index * variables, predefined conveying information: Auto-set. (line 6) * variables, private: Library Names. (line 11) * variables, setting: Options. (line 32) -* variables, shadowing: Definition Syntax. (line 71) +* variables, shadowing: Definition Syntax. (line 73) * variables, types of: Assignment Ops. (line 40) * variables, types of, comparison expressions and: Typing and Comparison. (line 9) @@ -34604,528 +34773,528 @@ Node: More Complex102678 Node: Statements/Lines105540 Ref: Statements/Lines-Footnote-1109995 Node: Other Features110260 -Node: When111191 -Ref: When-Footnote-1112945 -Node: Intro Summary113010 -Node: Invoking Gawk113893 -Node: Command Line115407 -Node: Options116205 -Ref: Options-Footnote-1132009 -Ref: Options-Footnote-2132238 -Node: Other Arguments132263 -Node: Naming Standard Input135211 -Node: Environment Variables136304 -Node: AWKPATH Variable136862 -Ref: AWKPATH Variable-Footnote-1140275 -Ref: AWKPATH Variable-Footnote-2140320 -Node: AWKLIBPATH Variable140580 -Node: Other Environment Variables141836 -Node: Exit Status145324 -Node: Include Files146000 -Node: Loading Shared Libraries149597 -Node: Obsolete151024 -Node: Undocumented151721 -Node: Invoking Summary151988 -Node: Regexp153652 -Node: Regexp Usage155106 -Node: Escape Sequences157143 -Node: Regexp Operators163384 -Ref: Regexp Operators-Footnote-1170810 -Ref: Regexp Operators-Footnote-2170957 -Node: Bracket Expressions171055 -Ref: table-char-classes173070 -Node: Leftmost Longest175994 -Node: Computed Regexps177296 -Node: GNU Regexp Operators180693 -Node: Case-sensitivity184366 -Ref: Case-sensitivity-Footnote-1187251 -Ref: Case-sensitivity-Footnote-2187486 -Node: Regexp Summary187594 -Node: Reading Files189061 -Node: Records191224 -Node: awk split records191957 -Node: gawk split records196872 -Ref: gawk split records-Footnote-1201416 -Node: Fields201453 -Ref: Fields-Footnote-1204229 -Node: Nonconstant Fields204315 -Ref: Nonconstant Fields-Footnote-1206558 -Node: Changing Fields206762 -Node: Field Separators212691 -Node: Default Field Splitting215396 -Node: Regexp Field Splitting216513 -Node: Single Character Fields219863 -Node: Command Line Field Separator220922 -Node: Full Line Fields224134 -Ref: Full Line Fields-Footnote-1225651 -Ref: Full Line Fields-Footnote-2225697 -Node: Field Splitting Summary225798 -Node: Constant Size227872 -Node: Splitting By Content232461 -Ref: Splitting By Content-Footnote-1236455 -Node: Multiple Line236618 -Ref: Multiple Line-Footnote-1242504 -Node: Getline242683 -Node: Plain Getline245167 -Node: Getline/Variable247807 -Node: Getline/File248955 -Node: Getline/Variable/File250339 -Ref: Getline/Variable/File-Footnote-1251942 -Node: Getline/Pipe252029 -Node: Getline/Variable/Pipe254712 -Node: Getline/Coprocess255843 -Node: Getline/Variable/Coprocess257095 -Node: Getline Notes257834 -Node: Getline Summary260626 -Ref: table-getline-variants261038 -Node: Read Timeout261867 -Ref: Read Timeout-Footnote-1265757 -Node: Retrying Input265815 -Node: Command-line directories267010 -Node: Input Summary267917 -Node: Input Exercises271218 -Node: Printing271946 -Node: Print273723 -Node: Print Examples275180 -Node: Output Separators277959 -Node: OFMT279977 -Node: Printf281331 -Node: Basic Printf282116 -Node: Control Letters283686 -Node: Format Modifiers287669 -Node: Printf Examples293678 -Node: Redirection296164 -Node: Special FD303005 -Ref: Special FD-Footnote-1306165 -Node: Special Files306239 -Node: Other Inherited Files306856 -Node: Special Network307856 -Node: Special Caveats308718 -Node: Close Files And Pipes309669 -Ref: Close Files And Pipes-Footnote-1316851 -Ref: Close Files And Pipes-Footnote-2316999 -Node: Output Summary317149 -Node: Output Exercises318147 -Node: Expressions318827 -Node: Values320012 -Node: Constants320690 -Node: Scalar Constants321381 -Ref: Scalar Constants-Footnote-1322240 -Node: Nondecimal-numbers322490 -Node: Regexp Constants325508 -Node: Using Constant Regexps326033 -Node: Variables329176 -Node: Using Variables329831 -Node: Assignment Options331742 -Node: Conversion333617 -Node: Strings And Numbers334141 -Ref: Strings And Numbers-Footnote-1337206 -Node: Locale influences conversions337315 -Ref: table-locale-affects340062 -Node: All Operators340650 -Node: Arithmetic Ops341280 -Node: Concatenation343785 -Ref: Concatenation-Footnote-1346604 -Node: Assignment Ops346710 -Ref: table-assign-ops351689 -Node: Increment Ops352961 -Node: Truth Values and Conditions356399 -Node: Truth Values357484 -Node: Typing and Comparison358533 -Node: Variable Typing359343 -Node: Comparison Operators362996 -Ref: table-relational-ops363406 -Node: POSIX String Comparison366901 -Ref: POSIX String Comparison-Footnote-1367973 -Node: Boolean Ops368111 -Ref: Boolean Ops-Footnote-1372590 -Node: Conditional Exp372681 -Node: Function Calls374408 -Node: Precedence378288 -Node: Locales381949 -Node: Expressions Summary383581 -Node: Patterns and Actions386141 -Node: Pattern Overview387261 -Node: Regexp Patterns388940 -Node: Expression Patterns389483 -Node: Ranges393193 -Node: BEGIN/END396299 -Node: Using BEGIN/END397060 -Ref: Using BEGIN/END-Footnote-1399794 -Node: I/O And BEGIN/END399900 -Node: BEGINFILE/ENDFILE402214 -Node: Empty405115 -Node: Using Shell Variables405432 -Node: Action Overview407705 -Node: Statements410031 -Node: If Statement411879 -Node: While Statement413374 -Node: Do Statement415403 -Node: For Statement416547 -Node: Switch Statement419704 -Node: Break Statement422086 -Node: Continue Statement424127 -Node: Next Statement425954 -Node: Nextfile Statement428335 -Node: Exit Statement430965 -Node: Built-in Variables433368 -Node: User-modified434501 -Ref: User-modified-Footnote-1442182 -Node: Auto-set442244 -Ref: Auto-set-Footnote-1456460 -Ref: Auto-set-Footnote-2456665 -Node: ARGC and ARGV456721 -Node: Pattern Action Summary460939 -Node: Arrays463366 -Node: Array Basics464695 -Node: Array Intro465539 -Ref: figure-array-elements467503 -Ref: Array Intro-Footnote-1470029 -Node: Reference to Elements470157 -Node: Assigning Elements472609 -Node: Array Example473100 -Node: Scanning an Array474858 -Node: Controlling Scanning477874 -Ref: Controlling Scanning-Footnote-1483070 -Node: Numeric Array Subscripts483386 -Node: Uninitialized Subscripts485571 -Node: Delete487188 -Ref: Delete-Footnote-1489931 -Node: Multidimensional489988 -Node: Multiscanning493085 -Node: Arrays of Arrays494674 -Node: Arrays Summary499433 -Node: Functions501525 -Node: Built-in502424 -Node: Calling Built-in503502 -Node: Numeric Functions505493 -Ref: Numeric Functions-Footnote-1510312 -Ref: Numeric Functions-Footnote-2510669 -Ref: Numeric Functions-Footnote-3510717 -Node: String Functions510989 -Ref: String Functions-Footnote-1534464 -Ref: String Functions-Footnote-2534593 -Ref: String Functions-Footnote-3534841 -Node: Gory Details534928 -Ref: table-sub-escapes536709 -Ref: table-sub-proposed538229 -Ref: table-posix-sub539593 -Ref: table-gensub-escapes541129 -Ref: Gory Details-Footnote-1541961 -Node: I/O Functions542112 -Ref: I/O Functions-Footnote-1549330 -Node: Time Functions549477 -Ref: Time Functions-Footnote-1559965 -Ref: Time Functions-Footnote-2560033 -Ref: Time Functions-Footnote-3560191 -Ref: Time Functions-Footnote-4560302 -Ref: Time Functions-Footnote-5560414 -Ref: Time Functions-Footnote-6560641 -Node: Bitwise Functions560907 -Ref: table-bitwise-ops561469 -Ref: Bitwise Functions-Footnote-1565778 -Node: Type Functions565947 -Node: I18N Functions567098 -Node: User-defined568743 -Node: Definition Syntax569548 -Ref: Definition Syntax-Footnote-1574955 -Node: Function Example575026 -Ref: Function Example-Footnote-1577945 -Node: Function Caveats577967 -Node: Calling A Function578485 -Node: Variable Scope579443 -Node: Pass By Value/Reference582431 -Node: Return Statement585926 -Node: Dynamic Typing588907 -Node: Indirect Calls589836 -Ref: Indirect Calls-Footnote-1601138 -Node: Functions Summary601266 -Node: Library Functions603968 -Ref: Library Functions-Footnote-1607577 -Ref: Library Functions-Footnote-2607720 -Node: Library Names607891 -Ref: Library Names-Footnote-1611345 -Ref: Library Names-Footnote-2611568 -Node: General Functions611654 -Node: Strtonum Function612757 -Node: Assert Function615779 -Node: Round Function619103 -Node: Cliff Random Function620644 -Node: Ordinal Functions621660 -Ref: Ordinal Functions-Footnote-1624723 -Ref: Ordinal Functions-Footnote-2624975 -Node: Join Function625186 -Ref: Join Function-Footnote-1626955 -Node: Getlocaltime Function627155 -Node: Readfile Function630899 -Node: Shell Quoting632869 -Node: Data File Management634270 -Node: Filetrans Function634902 -Node: Rewind Function638958 -Node: File Checking640345 -Ref: File Checking-Footnote-1641677 -Node: Empty Files641878 -Node: Ignoring Assigns643857 -Node: Getopt Function645408 -Ref: Getopt Function-Footnote-1656870 -Node: Passwd Functions657070 -Ref: Passwd Functions-Footnote-1665907 -Node: Group Functions665995 -Ref: Group Functions-Footnote-1673889 -Node: Walking Arrays674102 -Node: Library Functions Summary675705 -Node: Library Exercises677106 -Node: Sample Programs678386 -Node: Running Examples679156 -Node: Clones679884 -Node: Cut Program681108 -Node: Egrep Program690827 -Ref: Egrep Program-Footnote-1698325 -Node: Id Program698435 -Node: Split Program702080 -Ref: Split Program-Footnote-1705528 -Node: Tee Program705656 -Node: Uniq Program708445 -Node: Wc Program715864 -Ref: Wc Program-Footnote-1720114 -Node: Miscellaneous Programs720208 -Node: Dupword Program721421 -Node: Alarm Program723452 -Node: Translate Program728256 -Ref: Translate Program-Footnote-1732821 -Node: Labels Program733091 -Ref: Labels Program-Footnote-1736442 -Node: Word Sorting736526 -Node: History Sorting740597 -Node: Extract Program742433 -Node: Simple Sed749958 -Node: Igawk Program753026 -Ref: Igawk Program-Footnote-1767350 -Ref: Igawk Program-Footnote-2767551 -Ref: Igawk Program-Footnote-3767673 -Node: Anagram Program767788 -Node: Signature Program770845 -Node: Programs Summary772092 -Node: Programs Exercises773285 -Ref: Programs Exercises-Footnote-1777416 -Node: Advanced Features777507 -Node: Nondecimal Data779455 -Node: Array Sorting781045 -Node: Controlling Array Traversal781742 -Ref: Controlling Array Traversal-Footnote-1790075 -Node: Array Sorting Functions790193 -Ref: Array Sorting Functions-Footnote-1794082 -Node: Two-way I/O794278 -Ref: Two-way I/O-Footnote-1799223 -Ref: Two-way I/O-Footnote-2799409 -Node: TCP/IP Networking799491 -Node: Profiling802364 -Node: Advanced Features Summary810641 -Node: Internationalization812574 -Node: I18N and L10N814054 -Node: Explaining gettext814740 -Ref: Explaining gettext-Footnote-1819765 -Ref: Explaining gettext-Footnote-2819949 -Node: Programmer i18n820114 -Ref: Programmer i18n-Footnote-1824980 -Node: Translator i18n825029 -Node: String Extraction825823 -Ref: String Extraction-Footnote-1826954 -Node: Printf Ordering827040 -Ref: Printf Ordering-Footnote-1829826 -Node: I18N Portability829890 -Ref: I18N Portability-Footnote-1832345 -Node: I18N Example832408 -Ref: I18N Example-Footnote-1835211 -Node: Gawk I18N835283 -Node: I18N Summary835921 -Node: Debugger837260 -Node: Debugging838282 -Node: Debugging Concepts838723 -Node: Debugging Terms840576 -Node: Awk Debugging843148 -Node: Sample Debugging Session844042 -Node: Debugger Invocation844562 -Node: Finding The Bug845946 -Node: List of Debugger Commands852421 -Node: Breakpoint Control853754 -Node: Debugger Execution Control857450 -Node: Viewing And Changing Data860814 -Node: Execution Stack864192 -Node: Debugger Info865829 -Node: Miscellaneous Debugger Commands869846 -Node: Readline Support874875 -Node: Limitations875767 -Node: Debugging Summary877881 -Node: Arbitrary Precision Arithmetic879049 -Node: Computer Arithmetic880465 -Ref: table-numeric-ranges884063 -Ref: Computer Arithmetic-Footnote-1884922 -Node: Math Definitions884979 -Ref: table-ieee-formats888267 -Ref: Math Definitions-Footnote-1888871 -Node: MPFR features888976 -Node: FP Math Caution890647 -Ref: FP Math Caution-Footnote-1891697 -Node: Inexactness of computations892066 -Node: Inexact representation893025 -Node: Comparing FP Values894382 -Node: Errors accumulate895464 -Node: Getting Accuracy896897 -Node: Try To Round899559 -Node: Setting precision900458 -Ref: table-predefined-precision-strings901142 -Node: Setting the rounding mode902931 -Ref: table-gawk-rounding-modes903295 -Ref: Setting the rounding mode-Footnote-1906750 -Node: Arbitrary Precision Integers906929 -Ref: Arbitrary Precision Integers-Footnote-1911828 -Node: POSIX Floating Point Problems911977 -Ref: POSIX Floating Point Problems-Footnote-1915850 -Node: Floating point summary915888 -Node: Dynamic Extensions918082 -Node: Extension Intro919634 -Node: Plugin License920900 -Node: Extension Mechanism Outline921697 -Ref: figure-load-extension922125 -Ref: figure-register-new-function923605 -Ref: figure-call-new-function924609 -Node: Extension API Description926595 -Node: Extension API Functions Introduction928129 -Node: General Data Types933001 -Ref: General Data Types-Footnote-1938740 -Node: Memory Allocation Functions939039 -Ref: Memory Allocation Functions-Footnote-1941878 -Node: Constructor Functions941974 -Node: Registration Functions943708 -Node: Extension Functions944393 -Node: Exit Callback Functions946690 -Node: Extension Version String947938 -Node: Input Parsers948603 -Node: Output Wrappers958482 -Node: Two-way processors962997 -Node: Printing Messages965201 -Ref: Printing Messages-Footnote-1966277 -Node: Updating `ERRNO'966429 -Node: Requesting Values967169 -Ref: table-value-types-returned967897 -Node: Accessing Parameters968854 -Node: Symbol Table Access970085 -Node: Symbol table by name970599 -Node: Symbol table by cookie972580 -Ref: Symbol table by cookie-Footnote-1976724 -Node: Cached values976787 -Ref: Cached values-Footnote-1980286 -Node: Array Manipulation980377 -Ref: Array Manipulation-Footnote-1981467 -Node: Array Data Types981504 -Ref: Array Data Types-Footnote-1984159 -Node: Array Functions984251 -Node: Flattening Arrays988105 -Node: Creating Arrays994997 -Node: Redirection API999768 -Node: Extension API Variables1002539 -Node: Extension Versioning1003172 -Node: Extension API Informational Variables1005073 -Node: Extension API Boilerplate1006138 -Node: Finding Extensions1009947 -Node: Extension Example1010507 -Node: Internal File Description1011279 -Node: Internal File Ops1015346 -Ref: Internal File Ops-Footnote-11027016 -Node: Using Internal File Ops1027156 -Ref: Using Internal File Ops-Footnote-11029539 -Node: Extension Samples1029812 -Node: Extension Sample File Functions1031338 -Node: Extension Sample Fnmatch1038976 -Node: Extension Sample Fork1040467 -Node: Extension Sample Inplace1041682 -Node: Extension Sample Ord1043357 -Node: Extension Sample Readdir1044193 -Ref: table-readdir-file-types1045069 -Node: Extension Sample Revout1045880 -Node: Extension Sample Rev2way1046470 -Node: Extension Sample Read write array1047210 -Node: Extension Sample Readfile1049150 -Node: Extension Sample Time1050245 -Node: Extension Sample API Tests1051594 -Node: gawkextlib1052085 -Node: Extension summary1054743 -Node: Extension Exercises1058432 -Node: Language History1059154 -Node: V7/SVR3.11060810 -Node: SVR41062991 -Node: POSIX1064436 -Node: BTL1065825 -Node: POSIX/GNU1066559 -Node: Feature History1072183 -Node: Common Extensions1085281 -Node: Ranges and Locales1086605 -Ref: Ranges and Locales-Footnote-11091223 -Ref: Ranges and Locales-Footnote-21091250 -Ref: Ranges and Locales-Footnote-31091484 -Node: Contributors1091705 -Node: History summary1097246 -Node: Installation1098616 -Node: Gawk Distribution1099562 -Node: Getting1100046 -Node: Extracting1100869 -Node: Distribution contents1102504 -Node: Unix Installation1108569 -Node: Quick Installation1109252 -Node: Shell Startup Files1111663 -Node: Additional Configuration Options1112742 -Node: Configuration Philosophy1114481 -Node: Non-Unix Installation1116850 -Node: PC Installation1117308 -Node: PC Binary Installation1118627 -Node: PC Compiling1120475 -Ref: PC Compiling-Footnote-11123496 -Node: PC Testing1123605 -Node: PC Using1124781 -Node: Cygwin1128896 -Node: MSYS1129719 -Node: VMS Installation1130219 -Node: VMS Compilation1131011 -Ref: VMS Compilation-Footnote-11132233 -Node: VMS Dynamic Extensions1132291 -Node: VMS Installation Details1133975 -Node: VMS Running1136227 -Node: VMS GNV1139063 -Node: VMS Old Gawk1139797 -Node: Bugs1140267 -Node: Other Versions1144150 -Node: Installation summary1150578 -Node: Notes1151634 -Node: Compatibility Mode1152499 -Node: Additions1153281 -Node: Accessing The Source1154206 -Node: Adding Code1155642 -Node: New Ports1161807 -Node: Derived Files1166289 -Ref: Derived Files-Footnote-11171764 -Ref: Derived Files-Footnote-21171798 -Ref: Derived Files-Footnote-31172394 -Node: Future Extensions1172508 -Node: Implementation Limitations1173114 -Node: Extension Design1174362 -Node: Old Extension Problems1175516 -Ref: Old Extension Problems-Footnote-11177033 -Node: Extension New Mechanism Goals1177090 -Ref: Extension New Mechanism Goals-Footnote-11180450 -Node: Extension Other Design Decisions1180639 -Node: Extension Future Growth1182747 -Node: Old Extension Mechanism1183583 -Node: Notes summary1185345 -Node: Basic Concepts1186531 -Node: Basic High Level1187212 -Ref: figure-general-flow1187484 -Ref: figure-process-flow1188083 -Ref: Basic High Level-Footnote-11191312 -Node: Basic Data Typing1191497 -Node: Glossary1194825 -Node: Copying1219983 -Node: GNU Free Documentation License1257539 -Node: Index1282675 +Node: When111196 +Ref: When-Footnote-1112950 +Node: Intro Summary113015 +Node: Invoking Gawk113899 +Node: Command Line115413 +Node: Options116211 +Ref: Options-Footnote-1132006 +Ref: Options-Footnote-2132235 +Node: Other Arguments132260 +Node: Naming Standard Input135208 +Node: Environment Variables136301 +Node: AWKPATH Variable136859 +Ref: AWKPATH Variable-Footnote-1140266 +Ref: AWKPATH Variable-Footnote-2140311 +Node: AWKLIBPATH Variable140571 +Node: Other Environment Variables141827 +Node: Exit Status145345 +Node: Include Files146021 +Node: Loading Shared Libraries149610 +Node: Obsolete151037 +Node: Undocumented151729 +Node: Invoking Summary151996 +Node: Regexp153659 +Node: Regexp Usage155113 +Node: Escape Sequences157150 +Node: Regexp Operators163390 +Ref: Regexp Operators-Footnote-1170800 +Ref: Regexp Operators-Footnote-2170947 +Node: Bracket Expressions171045 +Ref: table-char-classes173060 +Node: Leftmost Longest176002 +Node: Computed Regexps177304 +Node: GNU Regexp Operators180733 +Node: Case-sensitivity184405 +Ref: Case-sensitivity-Footnote-1187290 +Ref: Case-sensitivity-Footnote-2187525 +Node: Regexp Summary187633 +Node: Reading Files189100 +Node: Records191262 +Node: awk split records191995 +Node: gawk split records196924 +Ref: gawk split records-Footnote-1201463 +Node: Fields201500 +Ref: Fields-Footnote-1204278 +Node: Nonconstant Fields204364 +Ref: Nonconstant Fields-Footnote-1206602 +Node: Changing Fields206805 +Node: Field Separators212736 +Node: Default Field Splitting215440 +Node: Regexp Field Splitting216557 +Node: Single Character Fields219907 +Node: Command Line Field Separator220966 +Node: Full Line Fields224183 +Ref: Full Line Fields-Footnote-1225704 +Ref: Full Line Fields-Footnote-2225750 +Node: Field Splitting Summary225851 +Node: Constant Size227925 +Node: Splitting By Content232508 +Ref: Splitting By Content-Footnote-1236473 +Node: Multiple Line236636 +Ref: Multiple Line-Footnote-1242517 +Node: Getline242696 +Node: Plain Getline245175 +Node: Getline/Variable247815 +Node: Getline/File248964 +Node: Getline/Variable/File250349 +Ref: Getline/Variable/File-Footnote-1251952 +Node: Getline/Pipe252039 +Node: Getline/Variable/Pipe254717 +Node: Getline/Coprocess255848 +Node: Getline/Variable/Coprocess257112 +Node: Getline Notes257851 +Node: Getline Summary260645 +Ref: table-getline-variants261057 +Node: Read Timeout261886 +Ref: Read Timeout-Footnote-1265789 +Node: Retrying Input265847 +Node: Command-line directories267042 +Node: Input Summary267949 +Node: Input Exercises271334 +Node: Printing272062 +Node: Print273839 +Node: Print Examples275296 +Node: Output Separators278075 +Node: OFMT280093 +Node: Printf281448 +Node: Basic Printf282233 +Node: Control Letters283805 +Node: Format Modifiers287790 +Node: Printf Examples293800 +Node: Redirection296286 +Node: Special FD303124 +Ref: Special FD-Footnote-1306290 +Node: Special Files306364 +Node: Other Inherited Files306981 +Node: Special Network307981 +Node: Special Caveats308843 +Node: Close Files And Pipes309792 +Ref: Close Files And Pipes-Footnote-1316983 +Ref: Close Files And Pipes-Footnote-2317131 +Node: Output Summary317281 +Node: Output Exercises318279 +Node: Expressions318959 +Node: Values320148 +Node: Constants320825 +Node: Scalar Constants321516 +Ref: Scalar Constants-Footnote-1322378 +Node: Nondecimal-numbers322628 +Node: Regexp Constants325638 +Node: Using Constant Regexps326164 +Node: Variables329327 +Node: Using Variables329984 +Node: Assignment Options331895 +Node: Conversion333770 +Node: Strings And Numbers334294 +Ref: Strings And Numbers-Footnote-1337359 +Node: Locale influences conversions337468 +Ref: table-locale-affects340214 +Node: All Operators340806 +Node: Arithmetic Ops341435 +Node: Concatenation343940 +Ref: Concatenation-Footnote-1346759 +Node: Assignment Ops346866 +Ref: table-assign-ops351845 +Node: Increment Ops353155 +Node: Truth Values and Conditions356586 +Node: Truth Values357669 +Node: Typing and Comparison358718 +Node: Variable Typing359534 +Node: Comparison Operators363201 +Ref: table-relational-ops363611 +Node: POSIX String Comparison367106 +Ref: POSIX String Comparison-Footnote-1368178 +Node: Boolean Ops368317 +Ref: Boolean Ops-Footnote-1372795 +Node: Conditional Exp372886 +Node: Function Calls374624 +Node: Precedence378504 +Node: Locales382164 +Node: Expressions Summary383796 +Node: Patterns and Actions386367 +Node: Pattern Overview387487 +Node: Regexp Patterns389166 +Node: Expression Patterns389709 +Node: Ranges393418 +Node: BEGIN/END396525 +Node: Using BEGIN/END397286 +Ref: Using BEGIN/END-Footnote-1400022 +Node: I/O And BEGIN/END400128 +Node: BEGINFILE/ENDFILE402443 +Node: Empty405340 +Node: Using Shell Variables405657 +Node: Action Overview407930 +Node: Statements410256 +Node: If Statement412104 +Node: While Statement413599 +Node: Do Statement415627 +Node: For Statement416775 +Node: Switch Statement419933 +Node: Break Statement422315 +Node: Continue Statement424356 +Node: Next Statement426183 +Node: Nextfile Statement428564 +Node: Exit Statement431192 +Node: Built-in Variables433603 +Node: User-modified434736 +Ref: User-modified-Footnote-1442439 +Node: Auto-set442501 +Ref: Auto-set-Footnote-1456734 +Ref: Auto-set-Footnote-2456939 +Node: ARGC and ARGV456995 +Node: Pattern Action Summary461213 +Node: Arrays463646 +Node: Array Basics464975 +Node: Array Intro465819 +Ref: figure-array-elements467753 +Ref: Array Intro-Footnote-1470373 +Node: Reference to Elements470501 +Node: Assigning Elements472963 +Node: Array Example473454 +Node: Scanning an Array475213 +Node: Controlling Scanning478233 +Ref: Controlling Scanning-Footnote-1483627 +Node: Numeric Array Subscripts483943 +Node: Uninitialized Subscripts486128 +Node: Delete487745 +Ref: Delete-Footnote-1490494 +Node: Multidimensional490551 +Node: Multiscanning493648 +Node: Arrays of Arrays495237 +Node: Arrays Summary499991 +Node: Functions502082 +Node: Built-in503121 +Node: Calling Built-in504199 +Node: Numeric Functions506194 +Ref: Numeric Functions-Footnote-1511012 +Ref: Numeric Functions-Footnote-2511369 +Ref: Numeric Functions-Footnote-3511417 +Node: String Functions511689 +Ref: String Functions-Footnote-1535190 +Ref: String Functions-Footnote-2535319 +Ref: String Functions-Footnote-3535567 +Node: Gory Details535654 +Ref: table-sub-escapes537435 +Ref: table-sub-proposed538950 +Ref: table-posix-sub540312 +Ref: table-gensub-escapes541849 +Ref: Gory Details-Footnote-1542682 +Node: I/O Functions542833 +Ref: I/O Functions-Footnote-1550069 +Node: Time Functions550216 +Ref: Time Functions-Footnote-1560725 +Ref: Time Functions-Footnote-2560793 +Ref: Time Functions-Footnote-3560951 +Ref: Time Functions-Footnote-4561062 +Ref: Time Functions-Footnote-5561174 +Ref: Time Functions-Footnote-6561401 +Node: Bitwise Functions561667 +Ref: table-bitwise-ops562229 +Ref: Bitwise Functions-Footnote-1566541 +Node: Type Functions566713 +Node: I18N Functions567864 +Node: User-defined569509 +Node: Definition Syntax570314 +Ref: Definition Syntax-Footnote-1575813 +Node: Function Example575884 +Ref: Function Example-Footnote-1578803 +Node: Function Caveats578825 +Node: Calling A Function579343 +Node: Variable Scope580301 +Node: Pass By Value/Reference583289 +Node: Return Statement586784 +Node: Dynamic Typing589765 +Node: Indirect Calls590694 +Ref: Indirect Calls-Footnote-1602012 +Node: Functions Summary602140 +Node: Library Functions604842 +Ref: Library Functions-Footnote-1608451 +Ref: Library Functions-Footnote-2608594 +Node: Library Names608765 +Ref: Library Names-Footnote-1612219 +Ref: Library Names-Footnote-2612442 +Node: General Functions612528 +Node: Strtonum Function613631 +Node: Assert Function616653 +Node: Round Function619977 +Node: Cliff Random Function621518 +Node: Ordinal Functions622534 +Ref: Ordinal Functions-Footnote-1625597 +Ref: Ordinal Functions-Footnote-2625849 +Node: Join Function626060 +Ref: Join Function-Footnote-1627829 +Node: Getlocaltime Function628029 +Node: Readfile Function631773 +Node: Shell Quoting633743 +Node: Data File Management635144 +Node: Filetrans Function635776 +Node: Rewind Function639832 +Node: File Checking641219 +Ref: File Checking-Footnote-1642551 +Node: Empty Files642752 +Node: Ignoring Assigns644731 +Node: Getopt Function646282 +Ref: Getopt Function-Footnote-1657744 +Node: Passwd Functions657944 +Ref: Passwd Functions-Footnote-1666781 +Node: Group Functions666869 +Ref: Group Functions-Footnote-1674763 +Node: Walking Arrays674976 +Node: Library Functions Summary676579 +Node: Library Exercises677980 +Node: Sample Programs679260 +Node: Running Examples680030 +Node: Clones680758 +Node: Cut Program681982 +Node: Egrep Program691701 +Ref: Egrep Program-Footnote-1699199 +Node: Id Program699309 +Node: Split Program702954 +Ref: Split Program-Footnote-1706402 +Node: Tee Program706530 +Node: Uniq Program709319 +Node: Wc Program716738 +Ref: Wc Program-Footnote-1720988 +Node: Miscellaneous Programs721082 +Node: Dupword Program722295 +Node: Alarm Program724326 +Node: Translate Program729130 +Ref: Translate Program-Footnote-1733695 +Node: Labels Program733965 +Ref: Labels Program-Footnote-1737316 +Node: Word Sorting737400 +Node: History Sorting741471 +Node: Extract Program743307 +Node: Simple Sed750832 +Node: Igawk Program753900 +Ref: Igawk Program-Footnote-1768224 +Ref: Igawk Program-Footnote-2768425 +Ref: Igawk Program-Footnote-3768547 +Node: Anagram Program768662 +Node: Signature Program771719 +Node: Programs Summary772966 +Node: Programs Exercises774159 +Ref: Programs Exercises-Footnote-1778290 +Node: Advanced Features778381 +Node: Nondecimal Data780329 +Node: Array Sorting781919 +Node: Controlling Array Traversal782616 +Ref: Controlling Array Traversal-Footnote-1790949 +Node: Array Sorting Functions791067 +Ref: Array Sorting Functions-Footnote-1794956 +Node: Two-way I/O795152 +Ref: Two-way I/O-Footnote-1800097 +Ref: Two-way I/O-Footnote-2800283 +Node: TCP/IP Networking800365 +Node: Profiling803238 +Node: Advanced Features Summary811515 +Node: Internationalization813448 +Node: I18N and L10N814928 +Node: Explaining gettext815614 +Ref: Explaining gettext-Footnote-1820639 +Ref: Explaining gettext-Footnote-2820823 +Node: Programmer i18n820988 +Ref: Programmer i18n-Footnote-1825854 +Node: Translator i18n825903 +Node: String Extraction826697 +Ref: String Extraction-Footnote-1827828 +Node: Printf Ordering827914 +Ref: Printf Ordering-Footnote-1830700 +Node: I18N Portability830764 +Ref: I18N Portability-Footnote-1833219 +Node: I18N Example833282 +Ref: I18N Example-Footnote-1836085 +Node: Gawk I18N836157 +Node: I18N Summary836795 +Node: Debugger838134 +Node: Debugging839156 +Node: Debugging Concepts839597 +Node: Debugging Terms841450 +Node: Awk Debugging844022 +Node: Sample Debugging Session844916 +Node: Debugger Invocation845436 +Node: Finding The Bug846820 +Node: List of Debugger Commands853295 +Node: Breakpoint Control854628 +Node: Debugger Execution Control858324 +Node: Viewing And Changing Data861688 +Node: Execution Stack865066 +Node: Debugger Info866703 +Node: Miscellaneous Debugger Commands870720 +Node: Readline Support875749 +Node: Limitations876641 +Node: Debugging Summary878755 +Node: Arbitrary Precision Arithmetic879923 +Node: Computer Arithmetic881339 +Ref: table-numeric-ranges884937 +Ref: Computer Arithmetic-Footnote-1885796 +Node: Math Definitions885853 +Ref: table-ieee-formats889141 +Ref: Math Definitions-Footnote-1889745 +Node: MPFR features889850 +Node: FP Math Caution891521 +Ref: FP Math Caution-Footnote-1892571 +Node: Inexactness of computations892940 +Node: Inexact representation893899 +Node: Comparing FP Values895256 +Node: Errors accumulate896338 +Node: Getting Accuracy897771 +Node: Try To Round900433 +Node: Setting precision901332 +Ref: table-predefined-precision-strings902016 +Node: Setting the rounding mode903805 +Ref: table-gawk-rounding-modes904169 +Ref: Setting the rounding mode-Footnote-1907624 +Node: Arbitrary Precision Integers907803 +Ref: Arbitrary Precision Integers-Footnote-1912703 +Node: POSIX Floating Point Problems912852 +Ref: POSIX Floating Point Problems-Footnote-1916725 +Node: Floating point summary916763 +Node: Dynamic Extensions918957 +Node: Extension Intro920509 +Node: Plugin License921775 +Node: Extension Mechanism Outline922572 +Ref: figure-load-extension923000 +Ref: figure-register-new-function924480 +Ref: figure-call-new-function925484 +Node: Extension API Description927470 +Node: Extension API Functions Introduction929004 +Node: General Data Types933876 +Ref: General Data Types-Footnote-1939615 +Node: Memory Allocation Functions939914 +Ref: Memory Allocation Functions-Footnote-1942753 +Node: Constructor Functions942849 +Node: Registration Functions944583 +Node: Extension Functions945268 +Node: Exit Callback Functions947565 +Node: Extension Version String948813 +Node: Input Parsers949478 +Node: Output Wrappers959357 +Node: Two-way processors963872 +Node: Printing Messages966076 +Ref: Printing Messages-Footnote-1967152 +Node: Updating `ERRNO'967304 +Node: Requesting Values968044 +Ref: table-value-types-returned968772 +Node: Accessing Parameters969729 +Node: Symbol Table Access970960 +Node: Symbol table by name971474 +Node: Symbol table by cookie973455 +Ref: Symbol table by cookie-Footnote-1977599 +Node: Cached values977662 +Ref: Cached values-Footnote-1981161 +Node: Array Manipulation981252 +Ref: Array Manipulation-Footnote-1982342 +Node: Array Data Types982379 +Ref: Array Data Types-Footnote-1985034 +Node: Array Functions985126 +Node: Flattening Arrays988980 +Node: Creating Arrays995872 +Node: Redirection API1000643 +Node: Extension API Variables1003414 +Node: Extension Versioning1004047 +Node: Extension API Informational Variables1005948 +Node: Extension API Boilerplate1007013 +Node: Finding Extensions1010822 +Node: Extension Example1011382 +Node: Internal File Description1012154 +Node: Internal File Ops1016221 +Ref: Internal File Ops-Footnote-11027891 +Node: Using Internal File Ops1028031 +Ref: Using Internal File Ops-Footnote-11030414 +Node: Extension Samples1030687 +Node: Extension Sample File Functions1032213 +Node: Extension Sample Fnmatch1039851 +Node: Extension Sample Fork1041342 +Node: Extension Sample Inplace1042557 +Node: Extension Sample Ord1044232 +Node: Extension Sample Readdir1045068 +Ref: table-readdir-file-types1045944 +Node: Extension Sample Revout1046755 +Node: Extension Sample Rev2way1047345 +Node: Extension Sample Read write array1048085 +Node: Extension Sample Readfile1050025 +Node: Extension Sample Time1051120 +Node: Extension Sample API Tests1052469 +Node: gawkextlib1052960 +Node: Extension summary1055618 +Node: Extension Exercises1059307 +Node: Language History1060029 +Node: V7/SVR3.11061685 +Node: SVR41063866 +Node: POSIX1065311 +Node: BTL1066700 +Node: POSIX/GNU1067434 +Node: Feature History1073058 +Node: Common Extensions1086156 +Node: Ranges and Locales1087480 +Ref: Ranges and Locales-Footnote-11092098 +Ref: Ranges and Locales-Footnote-21092125 +Ref: Ranges and Locales-Footnote-31092359 +Node: Contributors1092580 +Node: History summary1098121 +Node: Installation1099491 +Node: Gawk Distribution1100437 +Node: Getting1100921 +Node: Extracting1101744 +Node: Distribution contents1103379 +Node: Unix Installation1109444 +Node: Quick Installation1110127 +Node: Shell Startup Files1112538 +Node: Additional Configuration Options1113617 +Node: Configuration Philosophy1115356 +Node: Non-Unix Installation1117725 +Node: PC Installation1118183 +Node: PC Binary Installation1119502 +Node: PC Compiling1121350 +Ref: PC Compiling-Footnote-11124371 +Node: PC Testing1124480 +Node: PC Using1125656 +Node: Cygwin1129771 +Node: MSYS1130594 +Node: VMS Installation1131094 +Node: VMS Compilation1131886 +Ref: VMS Compilation-Footnote-11133108 +Node: VMS Dynamic Extensions1133166 +Node: VMS Installation Details1134850 +Node: VMS Running1137102 +Node: VMS GNV1139938 +Node: VMS Old Gawk1140672 +Node: Bugs1141142 +Node: Other Versions1145025 +Node: Installation summary1151449 +Node: Notes1152505 +Node: Compatibility Mode1153370 +Node: Additions1154152 +Node: Accessing The Source1155077 +Node: Adding Code1156512 +Node: New Ports1162669 +Node: Derived Files1167151 +Ref: Derived Files-Footnote-11172626 +Ref: Derived Files-Footnote-21172660 +Ref: Derived Files-Footnote-31173256 +Node: Future Extensions1173370 +Node: Implementation Limitations1173976 +Node: Extension Design1175224 +Node: Old Extension Problems1176378 +Ref: Old Extension Problems-Footnote-11177895 +Node: Extension New Mechanism Goals1177952 +Ref: Extension New Mechanism Goals-Footnote-11181312 +Node: Extension Other Design Decisions1181501 +Node: Extension Future Growth1183609 +Node: Old Extension Mechanism1184445 +Node: Notes summary1186207 +Node: Basic Concepts1187393 +Node: Basic High Level1188074 +Ref: figure-general-flow1188346 +Ref: figure-process-flow1188945 +Ref: Basic High Level-Footnote-11192174 +Node: Basic Data Typing1192359 +Node: Glossary1195687 +Node: Copying1227616 +Node: GNU Free Documentation License1265172 +Node: Index1290308 End Tag Table |