aboutsummaryrefslogtreecommitdiffstats
path: root/doc/gawk.info
diff options
context:
space:
mode:
Diffstat (limited to 'doc/gawk.info')
-rw-r--r--doc/gawk.info2956
1 files changed, 1540 insertions, 1416 deletions
diff --git a/doc/gawk.info b/doc/gawk.info
index 15f5d978..95788ec2 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -247,6 +247,7 @@ entitled "GNU Free Documentation License".
* Special Caveats:: Things to watch out for.
* Close Files And Pipes:: Closing Input and Output Files and
Pipes.
+* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
* Values:: Constants, Variables, and Regular
@@ -956,7 +957,7 @@ provided in *note Language History::. The language described in this
Info file is often referred to as "new `awk'." By analogy, the
original version of `awk' is referred to as "old `awk'."
- Today, on most systems, when you run the `awk' utility you get some
+ On most current systems, when you run the `awk' utility you get some
version of new `awk'.(1) If your system's standard `awk' is the old
one, you will see something like this if you try the test program:
@@ -1377,6 +1378,12 @@ also must acknowledge my gratitude to G-d, for the many opportunities
He has sent my way, as well as for the gifts He has given me with which
to take advantage of those opportunities.
+
+Arnold Robbins
+Nof Ayalon
+Israel
+February 2015
+

File: gawk.info, Node: Getting Started, Next: Invoking Gawk, Prev: Preface, Up: Top
@@ -1870,7 +1877,7 @@ file surrounded by double quotes:

File: gawk.info, Node: Sample Data Files, Next: Very Simple, Prev: Running gawk, Up: Getting Started
-1.2 Data Files for the Examples
+1.2 Data files for the Examples
===============================
Many of the examples in this Info file take their input from two sample
@@ -3009,7 +3016,8 @@ used by regular users:
`GAWK_SOCK_RETRIES'
Controls the number of times `gawk' attempts to retry a two-way
TCP/IP (socket) connection before giving up. *Note TCP/IP
- Networking::.
+ Networking::. Note that when nonfatal I/O is enabled (*note
+ Nonfatal::), `gawk' only tries to open a TCP/IP socket once.
`POSIXLY_CORRECT'
Causes `gawk' to switch to POSIX-compatibility mode, disabling all
@@ -3455,8 +3463,8 @@ sequences apply to both string constants and regexp constants:
would continue incorporating hexadecimal digits into the
value until a non-hexadecimal digit or the end of the string
was encountered. However, using more than two hexadecimal
- digits produced undefined results. As of version *FIXME:*
- 4.3.0, only two digits are processed.
+ digits produced undefined results. As of version 4.2, only
+ two digits are processed.
`\/'
A literal slash (necessary for regexp constants only). This
@@ -5095,9 +5103,9 @@ the built-in variable `FIELDWIDTHS'. Each number specifies the width
of the field, _including_ columns between fields. If you want to
ignore the columns between fields, you can specify the width as a
separate field that is subsequently ignored. It is a fatal error to
-supply a field width that is not a positive number. The following data
-is the output of the Unix `w' utility. It is useful to illustrate the
-use of `FIELDWIDTHS':
+supply a field width that has a negative value. The following data is
+the output of the Unix `w' utility. It is useful to illustrate the use
+of `FIELDWIDTHS':
10:06pm up 21 days, 14:04, 23 users
User tty login idle JCPU PCPU what
@@ -6157,6 +6165,7 @@ function.
`gawk' allows access to inherited file
descriptors.
* Close Files And Pipes:: Closing Input and Output Files and Pipes.
+* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
@@ -6554,7 +6563,7 @@ which they may appear:
messages at runtime. *Note Printf Ordering::, which describes how
and why to use positional specifiers. For now, we ignore them.
-`- (Minus)'
+`-' (Minus)
The minus sign, used before the width modifier (see later on in
this list), says to left-justify the argument within its specified
width. Normally, the argument is printed right-justified in the
@@ -6564,7 +6573,7 @@ which they may appear:
prints `foo*'.
-`SPACE'
+SPACE
For numeric conversions, prefix positive values with a space and
negative values with a minus sign.
@@ -6609,7 +6618,7 @@ which they may appear:
programs. For information on appropriate quoting tricks, see
*note Quoting::.
-`WIDTH'
+WIDTH
This is a number specifying the desired minimum width of a field.
Inserting any number between the `%' sign and the format-control
character forces the field to expand to this width. The default
@@ -6987,7 +6996,7 @@ option (*note Options::).

File: gawk.info, Node: Special Files, Next: Close Files And Pipes, Prev: Special FD, Up: Printing
-5.8 Special File Names in `gawk'
+5.8 Special File names in `gawk'
================================
Besides access to standard input, standard output, and standard error,
@@ -7048,7 +7057,7 @@ mentioned here only for completeness. Full discussion is delayed until

File: gawk.info, Node: Special Caveats, Prev: Special Network, Up: Special Files
-5.8.3 Special File Name Caveats
+5.8.3 Special File name Caveats
-------------------------------
Here are some things to bear in mind when using the special file names
@@ -7070,7 +7079,7 @@ that `gawk' provides:
behavior.

-File: gawk.info, Node: Close Files And Pipes, Next: Output Summary, Prev: Special Files, Up: Printing
+File: gawk.info, Node: Close Files And Pipes, Next: Nonfatal, Prev: Special Files, Up: Printing
5.9 Closing Input and Output Redirections
=========================================
@@ -7239,9 +7248,68 @@ call. See the system manual pages for information on how to decode this
value.

-File: gawk.info, Node: Output Summary, Next: Output Exercises, Prev: Close Files And Pipes, Up: Printing
+File: gawk.info, Node: Nonfatal, Next: Output Summary, Prev: Close Files And Pipes, Up: Printing
+
+5.10 Enabling Nonfatal Output
+=============================
+
+This minor node describes a `gawk'-specific feature.
+
+ In standard `awk', output with `print' or `printf' to a nonexistent
+file, or some other I/O error (such as filling up the disk) is a fatal
+error.
+
+ $ gawk 'BEGIN { print "hi" > "/no/such/file" }'
+ error--> gawk: cmd. line:1: fatal: can't redirect to `/no/such/file' (No such file or directory)
+
+ `gawk' makes it possible to detect that an error has occurred,
+allowing you to possibly recover from the error, or at least print an
+error message of your choosing before exiting. You can do this in one
+of two ways:
+
+ * For all output files, by assigning any value to
+ `PROCINFO["NONFATAL"]'.
+
+ * On a per-file basis, by assigning any value to `PROCINFO[FILENAME,
+ "NONFATAL"]'. Here, FILENAME is the name of the file to which you
+ wish output to be nonfatal.
+
+ Once you have enabled nonfatal output, you must check `ERRNO' after
+every relevant `print' or `printf' statement to see if something went
+wrong. It is also a good idea to initialize `ERRNO' to zero before
+attempting the output. For example:
+
+ $ gawk '
+ > BEGIN {
+ > PROCINFO["NONFATAL"] = 1
+ > ERRNO = 0
+ > print "hi" > "/no/such/file"
+ > if (ERRNO) {
+ > print("Output failed:", ERRNO) > "/dev/stderr"
+ > exit 1
+ > }
+ > }'
+ error--> Output failed: No such file or directory
+
+ Here, `gawk' did not produce a fatal error; instead it let the `awk'
+program code detect the problem and handle it.
+
+ This mechanism works also for standard output and standard error.
+For standard output, you may use `PROCINFO["-", "NONFATAL"]' or
+`PROCINFO["/dev/stdout", "NONFATAL"]'. For standard error, use
+`PROCINFO["/dev/stderr", "NONFATAL"]'.
+
+ When attempting to open a TCP/IP socket (*note TCP/IP Networking::),
+`gawk' tries multiple times. The `GAWK_SOCK_RETRIES' environment
+variable (*note Other Environment Variables::) allows you to override
+`gawk''s builtin default number of attempts. However, once nonfatal
+I/O is enabled for a given socket, `gawk' only retries once, relying on
+`awk'-level code to notice that there was a problem.
+
+
+File: gawk.info, Node: Output Summary, Next: Output Exercises, Prev: Nonfatal, Up: Printing
-5.10 Summary
+5.11 Summary
============
* The `print' statement prints comma-separated expressions. Each
@@ -7263,11 +7331,16 @@ File: gawk.info, Node: Output Summary, Next: Output Exercises, Prev: Close Fi
For coprocesses, it is possible to close only one direction of the
communications.
+ * Normally errors with `print' or `printf' are fatal. `gawk' lets
+ you make output errors be nonfatal either for all files or on a
+ per-file basis. You must then check for errors after every
+ relevant output statement.
+

File: gawk.info, Node: Output Exercises, Prev: Output Summary, Up: Printing
-5.11 Exercises
+5.12 Exercises
==============
1. Rewrite the program:
@@ -9107,9 +9180,10 @@ accepts any record with a first field that contains `li':
-| 555-5553
-| 555-6699
- pattern. The expression `/li/' has the value one if `li' appears in
-the current input record. Thus, as a pattern, `/li/' matches any record
-containing `li'.
+ A regexp constant as a pattern is also a special case of an
+expression pattern. The expression `/li/' has the value one if `li'
+appears in the current input record. Thus, as a pattern, `/li/' matches
+any record containing `li'.
Boolean expressions are also commonly used as patterns. Whether the
pattern matches an input record depends on whether its subexpressions
@@ -9849,12 +9923,12 @@ divisor of any integer, and also identifies prime numbers:
# find smallest divisor of num
{
num = $1
- for (div = 2; div * div <= num; div++) {
- if (num % div == 0)
+ for (divisor = 2; divisor * divisor <= num; divisor++) {
+ if (num % divisor == 0)
break
}
- if (num % div == 0)
- printf "Smallest divisor of %d is %d\n", num, div
+ if (num % divisor == 0)
+ printf "Smallest divisor of %d is %d\n", num, divisor
else
printf "%d is prime\n", num
}
@@ -9872,12 +9946,12 @@ Statement::.)
# find smallest divisor of num
{
num = $1
- for (div = 2; ; div++) {
- if (num % div == 0) {
- printf "Smallest divisor of %d is %d\n", num, div
+ for (divisor = 2; ; divisor++) {
+ if (num % divisor == 0) {
+ printf "Smallest divisor of %d is %d\n", num, divisor
break
}
- if (div * div > num) {
+ if (divisor * divisor > num) {
printf "%d is prime\n", num
break
}
@@ -10212,15 +10286,14 @@ 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,
- regexp matching with `~' and `!~', as well as the `gensub()',
+ and all regular expression matching are case-independent. This
+ applies to regexp matching with `~' and `!~', the `gensub()',
`gsub()', `index()', `match()', `patsplit()', `split()', and
`sub()' functions, record termination with `RS', and field
- splitting with `FS' and `FPAT', all ignore case when doing their
- particular regexp operations. However, the value of `IGNORECASE'
- does _not_ affect array subscripting and it does not affect field
- splitting when using a single-character field separator. *Note
- Case-sensitivity::.
+ splitting with `FS' and `FPAT'. However, the value of
+ `IGNORECASE' does _not_ affect array subscripting and it does not
+ affect field splitting when using a single-character field
+ separator. *Note Case-sensitivity::.
`LINT #'
When this variable is true (nonzero or non-null), `gawk' behaves
@@ -10908,7 +10981,7 @@ be used as an array index.
including a specification of how many elements or components they
contain. In such languages, the declaration causes a contiguous block
of memory to be allocated for that many elements. Usually, an index in
-the array must be a positive integer. For example, the index zero
+the array must be a nonnegative integer. For example, the index zero
specifies the first element in the array, which is actually stored at
the beginning of the block of memory. Index one specifies the second
element, which is stored in memory right after the first element, and
@@ -10963,8 +11036,8 @@ It has elements 0-3 and 10, but doesn't have elements 4, 5, 6, 7, 8, or
9.
Another consequence of associative arrays is that the indices don't
-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
+have to be nonnegative 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 Value
@@ -11135,7 +11208,7 @@ File: gawk.info, Node: Scanning an Array, Next: Controlling Scanning, Prev: A
In programs that use arrays, it is often necessary to use a loop that
executes once for each element of an array. In other languages, where
-arrays are contiguous and indices are limited to positive integers,
+arrays are contiguous and indices are limited to nonnegative integers,
this is easy: all the valid indices can be found by counting from the
lowest index up to the highest. This technique won't do the job in
`awk', because any number or string can be an array index. So `awk'
@@ -12071,7 +12144,7 @@ numbers.
(2) `mawk' uses a different seed each time.
(3) Computer-generated random numbers really are not truly random.
-They are technically known as "pseudorandom." This means that although
+They are technically known as "pseudorandom". This means that although
the numbers in a sequence appear to be random, you can in fact generate
the same sequence of random numbers over and over again.
@@ -13395,13 +13468,14 @@ This program produces the following output when run:
-| lshift(0x99, 2) = 0x264 = 0000001001100100
-| rshift(0x99, 2) = 0x26 = 00100110
- The `bits2str()' function turns a binary number into a string. The
-number `1' represents a binary value where the rightmost bit is set to
-1. Using this mask, the function repeatedly checks the rightmost bit.
-ANDing the mask with the value indicates whether the rightmost bit is 1
-or not. If so, a `"1"' is concatenated onto the front of the string.
-Otherwise, a `"0"' is added. The value is then shifted right by one
-bit and the loop continues until there are no more 1 bits.
+ The `bits2str()' function turns a binary number into a string.
+Initializing `mask' to one creates a binary value where the rightmost
+bit is set to one. Using this mask, the function repeatedly checks the
+rightmost bit. ANDing the mask with the value indicates whether the
+rightmost bit is one or not. If so, a `"1"' is concatenated onto the
+front of the string. Otherwise, a `"0"' is added. The value is then
+shifted right by one bit and the loop continues until there are no more
+one bits.
If the initial value is zero, it returns a simple `"0"'. Otherwise,
at the end, it pads the value with zeros to represent multiples of
@@ -13430,7 +13504,7 @@ traverses every element of an array of arrays (*note Arrays of
Arrays::).
`isarray(X)'
- Return a true value if X is an array. Otherwise return false.
+ Return a true value if X is an array. Otherwise, return false.
`isarray()' is meant for use in two circumstances. The first is when
traversing a multidimensional array: you can test if an element is
@@ -13477,8 +13551,8 @@ brackets ([ ]):
Return the plural form used for NUMBER of the translation of
STRING1 and STRING2 in text domain DOMAIN for locale category
CATEGORY. STRING1 is the English singular variant of a message,
- and STRING2 the English plural variant of the same message. The
- default value for DOMAIN is the current value of `TEXTDOMAIN'.
+ and STRING2 is the English plural variant of the same message.
+ The default value for DOMAIN is the current value of `TEXTDOMAIN'.
The default value for CATEGORY is `"LC_MESSAGES"'.

@@ -13507,7 +13581,7 @@ File: gawk.info, Node: Definition Syntax, Next: Function Example, Up: User-de
9.2.1 Function Definition Syntax
--------------------------------
- It's entirely fair to say that the `awk' syntax for local variable
+ It's entirely fair to say that the awk syntax for local variable
definitions is appallingly awful. -- Brian Kernighan
Definitions of functions can appear anywhere between the rules of an
@@ -13550,9 +13624,9 @@ have a parameter with the same name as the function itself.
Local variables act like the empty string if referenced where a
string value is required, and like zero if referenced where a numeric
-value is required. This is the same as regular variables that have
-never been assigned a value. (There is more to understand about local
-variables; *note Dynamic Typing::.)
+value is required. This is the same as the behavior of regular
+variables that have never been assigned a value. (There is more to
+understand about local variables; *note Dynamic Typing::.)
The BODY-OF-FUNCTION consists of `awk' statements. It is the most
important part of the definition, because it says what the function
@@ -13581,9 +13655,9 @@ function is supposed to be used.
variable values hide, or "shadow", any variables of the same names used
in the rest of the program. The shadowed variables are not accessible
in the function definition, because there is no way to name them while
-their names have been taken away for the local variables. All other
-variables used in the `awk' program can be referenced or set normally
-in the function's body.
+their names have been taken away for the arguments and local variables.
+All other variables used in the `awk' program can be referenced or set
+normally in the function's body.
The arguments and local variables last only as long as the function
body is executing. Once the body finishes, you can once again access
@@ -13636,7 +13710,7 @@ takes a number and prints it in a specific format:
printf "%6.3g\n", num
}
-To illustrate, here is an `awk' rule that uses our `myprint' function:
+To illustrate, here is an `awk' rule that uses our `myprint()' function:
$3 > 0 { myprint($3) }
@@ -13665,13 +13739,13 @@ extra whitespace signifies the start of the local variable list):
When working with arrays, it is often necessary to delete all the
elements in an array and start over with a new list of elements (*note
Delete::). Instead of having to repeat this loop everywhere that you
-need to clear out an array, your program can just call `delarray'.
+need to clear out an array, your program can just call `delarray()'.
(This guarantees portability. The use of `delete ARRAY' to delete the
contents of an entire array is a relatively recent(1) addition to the
POSIX standard.)
The following is an example of a recursive function. It takes a
-string as an input parameter and returns the string in backwards order.
+string as an input parameter and returns the string in reverse order.
Recursive functions must always have a test that stops the recursion.
In this case, the recursion terminates when the input string is already
empty:
@@ -13762,14 +13836,14 @@ File: gawk.info, Node: Variable Scope, Next: Pass By Value/Reference, Prev: C
9.2.3.2 Controlling Variable Scope
..................................
-Unlike many languages, there is no way to make a variable local to a
+Unlike in many languages, there is no way to make a variable local to a
`{' ... `}' block in `awk', but you can make a variable local to a
function. It is good practice to do so whenever a variable is needed
only in that function.
To make a variable local to a function, simply declare the variable
as an argument after the actual function arguments (*note Definition
-Syntax::). Look at the following example where variable `i' is a
+Syntax::). Look at the following example, where variable `i' is a
global variable used by both functions `foo()' and `bar()':
function bar()
@@ -13805,7 +13879,7 @@ variable instance:
foo's i=3
top's i=3
- If you want `i' to be local to both `foo()' and `bar()' do as
+ If you want `i' to be local to both `foo()' and `bar()', do as
follows (the extra space before `i' is a coding convention to indicate
that `i' is a local variable, not an argument):
@@ -13887,7 +13961,7 @@ explicitly whether the arguments are passed "by value" or "by
reference".
Instead, the passing convention is determined at runtime when the
-function is called according to the following rule: if the argument is
+function is called, according to the following rule: if the argument is
an array variable, then it is passed by reference. Otherwise, the
argument is passed by value.
@@ -13945,7 +14019,7 @@ function _are_ visible outside that function.
stores `"two"' in the second element of `a'.
Some `awk' implementations allow you to call a function that has not
-been defined. They only report a problem at runtime when the program
+been defined. They only report a problem at runtime, when the program
actually tries to call the function. For example:
BEGIN {
@@ -13990,15 +14064,15 @@ undefined, and therefore, unpredictable. In practice, though, all
versions of `awk' simply return the null string, which acts like zero
if used in a numeric context.
- A `return' statement with no value expression is assumed at the end
-of every function definition. So if control reaches the end of the
-function body, then technically, the function returns an unpredictable
+ A `return' statement without an EXPRESSION is assumed at the end of
+every function definition. So, if control reaches the end of the
+function body, then technically the function returns an unpredictable
value. In practice, it returns the empty string. `awk' does _not_
warn you if you use the return value of such a function.
Sometimes, you want to write a function for what it does, not for
what it returns. Such a function corresponds to a `void' function in
-C, C++ or Java, or to a `procedure' in Ada. Thus, it may be
+C, C++, or Java, or to a `procedure' in Ada. Thus, it may be
appropriate to not return any value; simply bear in mind that you
should not be using the return value of such a function.
@@ -14104,13 +14178,13 @@ you can specify the name of the function to call as a string variable,
and then call the function. Let's look at an example.
Suppose you have a file with your test scores for the classes you
-are taking. The first field is the class name. The following fields
-are the functions to call to process the data, up to a "marker" field
+are taking, and you wish to get the sum and the average of your test
+scores. The first field is the class name. The following fields are
+the functions to call to process the data, up to a "marker" field
`data:'. Following the marker, to the end of the record, are the
various numeric test scores.
- Here is the initial file; you wish to get the sum and the average of
-your test scores:
+ Here is the initial file:
Biology_101 sum average data: 87.0 92.4 78.5 94.9
Chemistry_305 sum average data: 75.2 98.3 94.7 88.2
@@ -14168,9 +14242,9 @@ using indirect function calls:
return ret
}
- These two functions expect to work on fields; thus the parameters
+ These two functions expect to work on fields; thus, the parameters
`first' and `last' indicate where in the fields to start and end.
-Otherwise they perform the expected computations and are not unusual:
+Otherwise, they perform the expected computations and are not unusual:
# For each record, print the class name and the requested statistics
{
@@ -14223,18 +14297,19 @@ to force it to be a string value.)
may think at first. The C and C++ languages provide "function
pointers," which are a mechanism for calling a function chosen at
runtime. One of the most well-known uses of this ability is the C
-`qsort()' function, which sorts an array using the famous "quick sort"
+`qsort()' function, which sorts an array using the famous "quicksort"
algorithm (see the Wikipedia article
-(http://en.wikipedia.org/wiki/Quick_sort) for more information). To
-use this function, you supply a pointer to a comparison function. This
+(http://en.wikipedia.org/wiki/Quicksort) for more information). To use
+this function, you supply a pointer to a comparison function. This
mechanism allows you to sort arbitrary data in an arbitrary fashion.
We can do something similar using `gawk', like this:
# quicksort.awk --- Quicksort algorithm, with user-supplied
# comparison function
- # quicksort --- C.A.R. Hoare's quick sort algorithm. See Wikipedia
- # or almost any algorithms or computer science text
+
+ # quicksort --- C.A.R. Hoare's quicksort algorithm. See Wikipedia
+ # or almost any algorithms or computer science text.
function quicksort(data, left, right, less_than, i, last)
{
@@ -14263,7 +14338,7 @@ mechanism allows you to sort arbitrary data in an arbitrary fashion.
The `quicksort()' function receives the `data' array, the starting
and ending indices to sort (`left' and `right'), and the name of a
function that performs a "less than" comparison. It then implements
-the quick sort algorithm.
+the quicksort algorithm.
To make use of the sorting function, we return to our previous
example. The first thing to do is write some comparison functions:
@@ -14357,61 +14432,7 @@ names of the two comparison functions:
-| rsort: <100.0 95.6 93.4 87.1>
Another example where indirect functions calls are useful can be
-found in processing arrays. *note Walking Arrays::, presented a simple
-function for "walking" an array of arrays. That function simply
-printed the name and value of each scalar array element. However, it is
-easy to generalize that function, by passing in the name of a function
-to call when walking an array. The modified function looks like this:
-
- function process_array(arr, name, process, do_arrays, i, new_name)
- {
- for (i in arr) {
- new_name = (name "[" i "]")
- if (isarray(arr[i])) {
- if (do_arrays)
- @process(new_name, arr[i])
- process_array(arr[i], new_name, process, do_arrays)
- } else
- @process(new_name, arr[i])
- }
- }
-
- The arguments are as follows:
-
-`arr'
- The array.
-
-`name'
- The name of the array (a string).
-
-`process'
- The name of the function to call.
-
-`do_arrays'
- If this is true, the function can handle elements that are
- subarrays.
-
- If subarrays are to be processed, that is done before walking them
-further.
-
- When run with the following scaffolding, the function produces the
-same results as does the earlier `walk_array()' function:
-
- BEGIN {
- a[1] = 1
- a[2][1] = 21
- a[2][2] = 22
- a[3] = 3
- a[4][1][1] = 411
- a[4][2] = 42
-
- process_array(a, "a", "do_print", 0)
- }
-
- function do_print(name, element)
- {
- printf "%s = %s\n", name, element
- }
+found in processing arrays. This is described in *note Walking Arrays::.
Remember that you must supply a leading `@' in front of an indirect
function call.
@@ -14503,7 +14524,7 @@ File: gawk.info, Node: Library Functions, Next: Sample Programs, Prev: Functi
*note User-defined::, describes how to write your own `awk' functions.
Writing functions is important, because it allows you to encapsulate
algorithms and program tasks in a single place. It simplifies
-programming, making program development more manageable, and making
+programming, making program development more manageable and making
programs more readable.
In their seminal 1976 book, `Software Tools',(1) Brian Kernighan and
@@ -14608,7 +14629,7 @@ often use variable names like these for their own purposes.
The example programs shown in this major node all start the names of
their private variables with an underscore (`_'). Users generally
don't use leading underscores in their variable names, so this
-convention immediately decreases the chances that the variable name
+convention immediately decreases the chances that the variable names
will be accidentally shared with the user's program.
In addition, several of the library functions use a prefix that helps
@@ -14621,7 +14642,7 @@ for private function names.(1)
As a final note on variable naming, if a function makes global
variables available for use by a main program, it is a good convention
-to start that variable's name with a capital letter--for example,
+to start those variables' names with a capital letter--for example,
`getopt()''s `Opterr' and `Optind' variables (*note Getopt Function::).
The leading capital letter indicates that it is global, while the fact
that the variable name is not all capital letters indicates that the
@@ -14629,7 +14650,7 @@ variable is not one of `awk''s predefined variables, such as `FS'.
It is also important that _all_ variables in library functions that
do not need to save state are, in fact, declared local.(2) If this is
-not done, the variable could accidentally be used in the user's
+not done, the variables could accidentally be used in the user's
program, leading to bugs that are very difficult to track down:
function lib_func(x, y, l1, l2)
@@ -14807,7 +14828,7 @@ for use in printing the diagnostic message. This is not possible in
`awk', so this `assert()' function also requires a string version of
the condition that is being tested. Following is the function:
- # assert --- assert that a condition is true. Otherwise exit.
+ # assert --- assert that a condition is true. Otherwise, exit.
function assert(condition, string)
{
@@ -14828,7 +14849,7 @@ the condition that is being tested. Following is the function:
false, it prints a message to standard error, using the `string'
parameter to describe the failed condition. It then sets the variable
`_assert_exit' to one and executes the `exit' statement. The `exit'
-statement jumps to the `END' rule. If the `END' rules finds
+statement jumps to the `END' rule. If the `END' rule finds
`_assert_exit' to be true, it exits immediately.
The purpose of the test in the `END' rule is to keep any other `END'
@@ -15043,9 +15064,9 @@ the strings in an array into one long string. The following function,
`join()', accomplishes this task. It is used later in several of the
application programs (*note Sample Programs::).
- Good function design is important; this function needs to be general
-but it should also have a reasonable default behavior. It is called
-with an array as well as the beginning and ending indices of the
+ Good function design is important; this function needs to be
+general, but it should also have a reasonable default behavior. It is
+called with an array as well as the beginning and ending indices of the
elements in the array to be merged. This assumes that the array
indices are numeric--a reasonable assumption, as the array was likely
created with `split()' (*note String Functions::):
@@ -15164,7 +15185,7 @@ optional timestamp value to use instead of the current time.

File: gawk.info, Node: Readfile Function, Next: Shell Quoting, Prev: Getlocaltime Function, Up: General Functions
-10.2.8 Reading a Whole File At Once
+10.2.8 Reading a Whole File at Once
-----------------------------------
Often, it is convenient to have the entire contents of a file available
@@ -15206,13 +15227,13 @@ reads the entire contents of the named file in one shot:
It works by setting `RS' to `^$', a regular expression that will
never match if the file has contents. `gawk' reads data from the file
-into `tmp' attempting to match `RS'. The match fails after each read,
+into `tmp', attempting to match `RS'. The match fails after each read,
but fails quickly, such that `gawk' fills `tmp' with the entire
contents of the file. (*Note Records::, for information on `RT' and
`RS'.)
In the case that `file' is empty, the return value is the null
-string. Thus calling code may use something like:
+string. Thus, calling code may use something like:
contents = readfile("/some/path")
if (length(contents) == 0)
@@ -15279,7 +15300,7 @@ three-character string `"\"'\""':

File: gawk.info, Node: Data File Management, Next: Getopt Function, Prev: General Functions, Up: Library Functions
-10.3 Data File Management
+10.3 Data file Management
=========================
This minor node presents functions that are useful for managing
@@ -15296,14 +15317,15 @@ command-line data files.

File: gawk.info, Node: Filetrans Function, Next: Rewind Function, Up: Data File Management
-10.3.1 Noting Data File Boundaries
+10.3.1 Noting Data file Boundaries
----------------------------------
The `BEGIN' and `END' rules are each executed exactly once, at the
beginning and end of your `awk' program, respectively (*note
BEGIN/END::). We (the `gawk' authors) once had a user who mistakenly
-thought that the `BEGIN' rule is executed at the beginning of each data
-file and the `END' rule is executed at the end of each data file.
+thought that the `BEGIN' rules were executed at the beginning of each
+data file and the `END' rules were executed at the end of each data
+file.
When informed that this was not the case, the user requested that we
add new special patterns to `gawk', named `BEGIN_FILE' and `END_FILE',
@@ -15337,7 +15359,7 @@ does so _portably_; this works with any implementation of `awk':
This file must be loaded before the user's "main" program, so that
the rule it supplies is executed first.
- This rule relies on `awk''s `FILENAME' variable that automatically
+ This rule relies on `awk''s `FILENAME' variable, which automatically
changes for each new data file. The current file name is saved in a
private variable, `_oldfilename'. If `FILENAME' does not equal
`_oldfilename', then a new data file is being processed and it is
@@ -15352,7 +15374,7 @@ correctly even for the first data file.
The program also supplies an `END' rule to do the final processing
for the last file. Because this `END' rule comes before any `END' rules
supplied in the "main" program, `endfile()' is called first. Once
-again the value of multiple `BEGIN' and `END' rules should be clear.
+again, the value of multiple `BEGIN' and `END' rules should be clear.
If the same data file occurs twice in a row on the command line, then
`endfile()' and `beginfile()' are not executed at the end of the first
@@ -15379,7 +15401,7 @@ how it simplifies writing the main program.
You are probably wondering, if `beginfile()' and `endfile()'
functions can do the job, why does `gawk' have `BEGINFILE' and
-`ENDFILE' patterns (*note BEGINFILE/ENDFILE::)?
+`ENDFILE' patterns?
Good question. Normally, if `awk' cannot open a file, this causes
an immediate fatal error. In this case, there is no way for a
@@ -15387,7 +15409,8 @@ user-defined function to deal with the problem, as the mechanism for
calling it relies on the file being open and at the first record. Thus,
the main reason for `BEGINFILE' is to give you a "hook" to catch files
that cannot be processed. `ENDFILE' exists for symmetry, and because
-it provides an easy way to do per-file cleanup processing.
+it provides an easy way to do per-file cleanup processing. For more
+information, refer to *note BEGINFILE/ENDFILE::.

File: gawk.info, Node: Rewind Function, Next: File Checking, Prev: Filetrans Function, Up: Data File Management
@@ -15395,15 +15418,14 @@ File: gawk.info, Node: Rewind Function, Next: File Checking, Prev: Filetrans
10.3.2 Rereading the Current File
---------------------------------
-Another request for a new built-in function was for a `rewind()'
-function that would make it possible to reread the current file. The
-requesting user didn't want to have to use `getline' (*note Getline::)
-inside a loop.
+Another request for a new built-in function was for a function that
+would make it possible to reread the current file. The requesting user
+didn't want to have to use `getline' (*note Getline::) inside a loop.
However, as long as you are not in the `END' rule, it is quite easy
to arrange to immediately close the current input file and then start
-over with it from the top. For lack of a better name, we'll call it
-`rewind()':
+over with it from the top. For lack of a better name, we'll call the
+function `rewind()':
# rewind.awk --- rewind the current file and start over
@@ -15433,7 +15455,7 @@ rule finishes!)

File: gawk.info, Node: File Checking, Next: Empty Files, Prev: Rewind Function, Up: Data File Management
-10.3.3 Checking for Readable Data Files
+10.3.3 Checking for Readable Data files
---------------------------------------
Normally, if you give `awk' a data file that isn't readable, it stops
@@ -15461,7 +15483,7 @@ longer in the list). See also *note ARGC and ARGV::.
Because `awk' variable names only allow the English letters, the
regular expression check purposely does not use character classes such
-as `[:alpha:]' and `[:alnum:]' (*note Bracket Expressions::)
+as `[:alpha:]' and `[:alnum:]' (*note Bracket Expressions::).
---------- Footnotes ----------
@@ -15472,14 +15494,14 @@ opened. However, the code here provides a portable solution.

File: gawk.info, Node: Empty Files, Next: Ignoring Assigns, Prev: File Checking, Up: Data File Management
-10.3.4 Checking for Zero-length Files
+10.3.4 Checking for Zero-Length Files
-------------------------------------
All known `awk' implementations silently skip over zero-length files.
This is a by-product of `awk''s implicit
read-a-record-and-match-against-the-rules loop: when `awk' tries to
-read a record from an empty file, it immediately receives an end of
-file indication, closes the file, and proceeds on to the next
+read a record from an empty file, it immediately receives an
+end-of-file indication, closes the file, and proceeds on to the next
command-line data file, _without_ executing any user-level `awk'
program code.
@@ -15523,13 +15545,13 @@ of the `for' loop uses the `<=' operator, not `<'.

File: gawk.info, Node: Ignoring Assigns, Prev: Empty Files, Up: Data File Management
-10.3.5 Treating Assignments as File Names
+10.3.5 Treating Assignments as File names
-----------------------------------------
Occasionally, you might not want `awk' to process command-line variable
assignments (*note Assignment Options::). In particular, if you have a
file name that contains an `=' character, `awk' treats the file name as
-an assignment, and does not process it.
+an assignment and does not process it.
Some users have suggested an additional command-line option for
`gawk' to disable command-line assignments. However, some simple
@@ -15819,8 +15841,8 @@ which is in `ARGV[0]':
}
}
- The rest of the `BEGIN' rule is a simple test program. Here is the
-result of two sample runs of the test program:
+ The rest of the `BEGIN' rule is a simple test program. Here are the
+results of two sample runs of the test program:
$ awk -f getopt.awk -v _getopt_test=1 -- -a -cbARG bax -x
-| c = <a>, Optarg = <>
@@ -15866,10 +15888,10 @@ File: gawk.info, Node: Passwd Functions, Next: Group Functions, Prev: Getopt
==============================
The `PROCINFO' array (*note Built-in Variables::) provides access to
-the current user's real and effective user and group ID numbers, and if
-available, the user's supplementary group set. However, because these
-are numbers, they do not provide very useful information to the average
-user. There needs to be some way to find the user information
+the current user's real and effective user and group ID numbers, and,
+if available, the user's supplementary group set. However, because
+these are numbers, they do not provide very useful information to the
+average user. There needs to be some way to find the user information
associated with the user and group ID numbers. This minor node
presents a suite of functions for retrieving information from the user
database. *Note Group Functions::, for a similar suite that retrieves
@@ -15880,7 +15902,7 @@ kept. Instead, it provides the `<pwd.h>' header file and several C
language subroutines for obtaining user information. The primary
function is `getpwent()', for "get password entry." The "password"
comes from the original user database file, `/etc/passwd', which stores
-user information, along with the encrypted passwords (hence the name).
+user information along with the encrypted passwords (hence the name).
Although an `awk' program could simply read `/etc/passwd' directly,
this file may not contain complete information about the system's set
@@ -15928,7 +15950,7 @@ Encrypted password
User-ID
The user's numeric user ID number. (On some systems, it's a C
- `long', and not an `int'. Thus we cast it to `long' for all
+ `long', and not an `int'. Thus, we cast it to `long' for all
cases.)
Group-ID
@@ -16027,8 +16049,8 @@ or on some other `awk' implementation.
`PROCINFO["FS"]', is similar.
The main part of the function uses a loop to read database lines,
-split the line into fields, and then store the line into each array as
-necessary. When the loop is done, `_pw_init()' cleans up by closing
+split the lines into fields, and then store the lines into each array
+as necessary. When the loop is done, `_pw_init()' cleans up by closing
the pipeline, setting `_pw_inited' to one, and restoring `FS' (and
`FIELDWIDTHS' or `FPAT' if necessary), `RS', and `$0'. The use of
`_pw_count' is explained shortly.
@@ -16156,7 +16178,7 @@ Group Password
Group ID Number
The group's numeric group ID number; the association of name to
number must be unique within the file. (On some systems it's a C
- `long', and not an `int'. Thus we cast it to `long' for all
+ `long', and not an `int'. Thus, we cast it to `long' for all
cases.)
Group Member List
@@ -16246,29 +16268,30 @@ to ensure that the database is scanned no more than once. The
`_gr_init()' function first saves `FS', `RS', and `$0', and then sets
`FS' and `RS' to the correct values for scanning the group information.
It also takes care to note whether `FIELDWIDTHS' or `FPAT' is being
-used, and to restore the appropriate field splitting mechanism.
+used, and to restore the appropriate field-splitting mechanism.
- The group information is stored is several associative arrays. The
+ The group information is stored in several associative arrays. The
arrays are indexed by group name (`_gr_byname'), by group ID number
(`_gr_bygid'), and by position in the database (`_gr_bycount'). There
is an additional array indexed by username (`_gr_groupsbyuser'), which
is a space-separated list of groups to which each user belongs.
- Unlike the user database, it is possible to have multiple records in
-the database for the same group. This is common when a group has a
+ Unlike in the user database, it is possible to have multiple records
+in the database for the same group. This is common when a group has a
large number of members. A pair of such entries might look like the
following:
- tvpeople:*:101:johny,jay,arsenio
+ tvpeople:*:101:johnny,jay,arsenio
tvpeople:*:101:david,conan,tom,joan
For this reason, `_gr_init()' looks to see if a group name or group
-ID number is already seen. If it is, the usernames are simply
+ID number is already seen. If so, the usernames are simply
concatenated onto the previous list of users.(1)
Finally, `_gr_init()' closes the pipeline to `grcat', restores `FS'
-(and `FIELDWIDTHS' or `FPAT' if necessary), `RS', and `$0', initializes
-`_gr_count' to zero (it is used later), and makes `_gr_inited' nonzero.
+(and `FIELDWIDTHS' or `FPAT', if necessary), `RS', and `$0',
+initializes `_gr_count' to zero (it is used later), and makes
+`_gr_inited' nonzero.
The `getgrnam()' function takes a group name as its argument, and if
that group exists, it is returned. Otherwise, it relies on the array
@@ -16331,9 +16354,9 @@ very simple, relying on `awk''s associative arrays to do work.
---------- Footnotes ----------
- (1) There is actually a subtle problem with the code just presented.
-Suppose that the first time there were no names. This code adds the
-names with a leading comma. It also doesn't check that there is a `$4'.
+ (1) There is a subtle problem with the code just presented. Suppose
+that the first time there were no names. This code adds the names with
+a leading comma. It also doesn't check that there is a `$4'.

File: gawk.info, Node: Walking Arrays, Next: Library Functions Summary, Prev: Group Functions, Up: Library Functions
@@ -16342,11 +16365,11 @@ File: gawk.info, Node: Walking Arrays, Next: Library Functions Summary, Prev:
================================
*note Arrays of Arrays::, described how `gawk' provides arrays of
-arrays. In particular, any element of an array may be either a scalar,
+arrays. In particular, any element of an array may be either a scalar
or another array. The `isarray()' function (*note Type Functions::)
lets you distinguish an array from a scalar. The following function,
-`walk_array()', recursively traverses an array, printing each element's
-indices and value. You call it with the array and a string
+`walk_array()', recursively traverses an array, printing the element
+indices and values. You call it with the array and a string
representing the name of the array:
function walk_array(arr, name, i)
@@ -16386,6 +16409,61 @@ value. Here is a main program to demonstrate:
-| a[4][1][1] = 411
-| a[4][2] = 42
+ The function just presented simply prints the name and value of each
+scalar array element. However, it is easy to generalize it, by passing
+in the name of a function to call when walking an array. The modified
+function looks like this:
+
+ function process_array(arr, name, process, do_arrays, i, new_name)
+ {
+ for (i in arr) {
+ new_name = (name "[" i "]")
+ if (isarray(arr[i])) {
+ if (do_arrays)
+ @process(new_name, arr[i])
+ process_array(arr[i], new_name, process, do_arrays)
+ } else
+ @process(new_name, arr[i])
+ }
+ }
+
+ The arguments are as follows:
+
+`arr'
+ The array.
+
+`name'
+ The name of the array (a string).
+
+`process'
+ The name of the function to call.
+
+`do_arrays'
+ If this is true, the function can handle elements that are
+ subarrays.
+
+ If subarrays are to be processed, that is done before walking them
+further.
+
+ When run with the following scaffolding, the function produces the
+same results as does the earlier version of `walk_array()':
+
+ BEGIN {
+ a[1] = 1
+ a[2][1] = 21
+ a[2][2] = 22
+ a[3] = 3
+ a[4][1][1] = 411
+ a[4][2] = 42
+
+ process_array(a, "a", "do_print", 0)
+ }
+
+ function do_print(name, element)
+ {
+ printf "%s = %s\n", name, element
+ }
+

File: gawk.info, Node: Library Functions Summary, Next: Library Exercises, Prev: Walking Arrays, Up: Library Functions
@@ -16403,24 +16481,24 @@ File: gawk.info, Node: Library Functions Summary, Next: Library Exercises, Pr
* The functions presented here fit into the following categories:
General problems
- Number-to-string conversion, assertions, rounding, random
- number generation, converting characters to numbers, joining
- strings, getting easily usable time-of-day information, and
- reading a whole file in one shot.
+ Number-to-string conversion, testing assertions, rounding,
+ random number generation, converting characters to numbers,
+ joining strings, getting easily usable time-of-day
+ information, and reading a whole file in one shot
Managing data files
Noting data file boundaries, rereading the current file,
checking for readable files, checking for zero-length files,
- and treating assignments as file names.
+ and treating assignments as file names
Processing command-line options
- An `awk' version of the standard C `getopt()' function.
+ An `awk' version of the standard C `getopt()' function
Reading the user and group databases
- Two sets of routines that parallel the C library versions.
+ Two sets of routines that parallel the C library versions
Traversing arrays of arrays
- A simple function to traverse an array of arrays to any depth.
+ Two functions that traverse an array of arrays to any depth

@@ -16515,7 +16593,7 @@ you.
to replace the installed versions on your system. Nor may all of these
programs be fully compliant with the most recent POSIX standard. This
is not a problem; their purpose is to illustrate `awk' language
-programming for "real world" tasks.
+programming for "real-world" tasks.
The programs are presented in alphabetical order.
@@ -16541,7 +16619,7 @@ separated by TABs by default, but you may supply a command-line option
to change the field "delimiter" (i.e., the field-separator character).
`cut''s definition of fields is less general than `awk''s.
- A common use of `cut' might be to pull out just the login name of
+ A common use of `cut' might be to pull out just the login names of
logged-on users from the output of `who'. For example, the following
pipeline generates a sorted, unique list of the logged-on users:
@@ -16950,7 +17028,7 @@ unsuccessful match. If the line does not match, the `next' statement
just moves on to the next record.
A number of additional tests are made, but they are only done if we
-are not counting lines. First, if the user only wants exit status
+are not counting lines. First, if the user only wants the exit status
(`no_print' is true), then it is enough to know that _one_ line in this
file matched, and we can skip on to the next file with `nextfile'.
Similarly, if we are only printing file names, we can print the file
@@ -16984,7 +17062,7 @@ line is printed, with a leading file name and colon if necessary:
}
The `END' rule takes care of producing the correct exit status. If
-there are no matches, the exit status is one; otherwise it is zero:
+there are no matches, the exit status is one; otherwise, it is zero:
END {
exit (total == 0)
@@ -17026,7 +17104,8 @@ a more palatable output than just individual numbers.
Here is a simple version of `id' written in `awk'. It uses the user
database library functions (*note Passwd Functions::) and the group
-database library functions (*note Group Functions::):
+database library functions (*note Group Functions::) from *note Library
+Functions::.
The program is fairly straightforward. All the work is done in the
`BEGIN' rule. The user and group ID numbers are obtained from
@@ -17123,8 +17202,8 @@ is as follows:(1)
By default, the output files are named `xaa', `xab', and so on. Each
file has 1,000 lines in it, with the likely exception of the last file.
To change the number of lines in each file, supply a number on the
-command line preceded with a minus (e.g., `-500' for files with 500
-lines in them instead of 1,000). To change the name of the output
+command line preceded with a minus sign (e.g., `-500' for files with
+500 lines in them instead of 1,000). To change the names of the output
files to something like `myfileaa', `myfileab', and so on, supply an
additional argument that specifies the file name prefix.
@@ -17761,7 +17840,7 @@ checking and setting of defaults: the delay, the count, and the message
to print. If the user supplied a message without the ASCII BEL
character (known as the "alert" character, `"\a"'), then it is added to
the message. (On many systems, printing the ASCII BEL generates an
-audible alert. Thus when the alarm goes off, the system calls attention
+audible alert. Thus, when the alarm goes off, the system calls attention
to itself in case the user is not looking at the computer.) Just for a
change, this program uses a `switch' statement (*note Switch
Statement::), but the processing could be done with a series of
@@ -17893,7 +17972,7 @@ the "from" list.
Once upon a time, a user proposed adding a transliteration function
to `gawk'. The following program was written to prove that character
transliteration could be done with a user-level function. This program
-is not as complete as the system `tr' utility but it does most of the
+is not as complete as the system `tr' utility, but it does most of the
job.
The `translate' program was written long before `gawk' acquired the
@@ -17903,13 +17982,13 @@ and `gsub()' built-in functions (*note String Functions::). There are
two functions. The first, `stranslate()', takes three arguments:
`from'
- A list of characters from which to translate.
+ A list of characters from which to translate
`to'
- A list of characters to which to translate.
+ A list of characters to which to translate
`target'
- The string on which to do the translation.
+ The string on which to do the translation
Associative arrays make the translation part fairly easy. `t_ar'
holds the "to" characters, indexed by the "from" characters. Then a
@@ -17917,7 +17996,7 @@ simple loop goes through `from', one character at a time. For each
character in `from', if the character appears in `target', it is
replaced with the corresponding `to' character.
- The `translate()' function calls `stranslate()' using `$0' as the
+ The `translate()' function calls `stranslate()', using `$0' as the
target. The main program sets two global variables, `FROM' and `TO',
from the command line, and then changes `ARGV' so that `awk' reads from
the standard input.
@@ -17926,7 +18005,7 @@ the standard input.
record:
# translate.awk --- do tr-like stuff
- # Bugs: does not handle things like: tr A-Z a-z, it has
+ # Bugs: does not handle things like tr A-Z a-z; it has
# to be spelled out. However, if `to' is shorter than `from',
# the last character in `to' is used for the rest of `from'.
@@ -18004,13 +18083,13 @@ File: gawk.info, Node: Labels Program, Next: Word Sorting, Prev: Translate Pr
11.3.4 Printing Mailing Labels
------------------------------
-Here is a "real world"(1) program. This script reads lists of names and
+Here is a "real-world"(1) program. This script reads lists of names and
addresses and generates mailing labels. Each page of labels has 20
labels on it, two across and 10 down. The addresses are guaranteed to
be no more than five lines of data. Each address is separated from the
next by a blank line.
- The basic idea is to read 20 labels worth of data. Each line of
+ The basic idea is to read 20 labels' worth of data. Each line of
each label is stored in the `line' array. The single rule takes care
of filling the `line' array and printing the page when 20 labels have
been read.
@@ -18022,13 +18101,13 @@ splits records at blank lines (*note Records::). It sets `MAXLINES' to
Most of the work is done in the `printpage()' function. The label
lines are stored sequentially in the `line' array. But they have to
-print horizontally; `line[1]' next to `line[6]', `line[2]' next to
+print horizontally: `line[1]' next to `line[6]', `line[2]' next to
`line[7]', and so on. Two loops accomplish this. The outer loop,
controlled by `i', steps through every 10 lines of data; this is each
row of labels. The inner loop, controlled by `j', goes through the
-lines within the row. As `j' goes from 0 to 4, `i+j' is the `j'-th
-line in the row, and `i+j+5' is the entry next to it. The output ends
-up looking something like this:
+lines within the row. As `j' goes from 0 to 4, `i+j' is the `j'th line
+in the row, and `i+j+5' is the entry next to it. The output ends up
+looking something like this:
line 1 line 6
line 2 line 7
@@ -18131,8 +18210,8 @@ a useful format.
printf "%s\t%d\n", word, freq[word]
}
- The program relies on `awk''s default field splitting mechanism to
-break each line up into "words," and uses an associative array named
+ The program relies on `awk''s default field-splitting mechanism to
+break each line up into "words" and uses an associative array named
`freq', indexed by each word, to count the number of times the word
occurs. In the `END' rule, it prints the counts.
@@ -18218,7 +18297,7 @@ File: gawk.info, Node: History Sorting, Next: Extract Program, Prev: Word Sor
11.3.6 Removing Duplicates from Unsorted Text
---------------------------------------------
-The `uniq' program (*note Uniq Program::), removes duplicate lines from
+The `uniq' program (*note Uniq Program::) removes duplicate lines from
_sorted_ data.
Suppose, however, you need to remove duplicate lines from a data
@@ -18271,7 +18350,7 @@ hand. Here we present a program that can extract parts of a Texinfo
input file into separate files.
This Info file is written in Texinfo
-(http://www.gnu.org/software/texinfo/), the GNU project's document
+(http://www.gnu.org/software/texinfo/), the GNU Project's document
formatting language. A single Texinfo source file can be used to
produce both printed documentation, with TeX, and online documentation.
(The Texinfo language is described fully, starting with *note
@@ -18312,7 +18391,7 @@ them in a standard directory where `gawk' can find them. The Texinfo
file looks something like this:
...
- This program has a @code{BEGIN} rule,
+ This program has a @code{BEGIN} rule
that prints a nice message:
@example
@@ -18337,7 +18416,7 @@ upper- and lowercase letters in the directives won't matter.
given (`NF' is at least three) and also checking that the command exits
with a zero exit status, signifying OK:
- # extract.awk --- extract files and run programs from texinfo files
+ # extract.awk --- extract files and run programs from Texinfo files
BEGIN { IGNORECASE = 1 }
@@ -18364,11 +18443,11 @@ The variable `e' is used so that the rule fits nicely on the screen.
file name is given in the directive. If the file named is not the
current file, then the current file is closed. Keeping the current file
open until a new file is encountered allows the use of the `>'
-redirection for printing the contents, keeping open file management
+redirection for printing the contents, keeping open-file management
simple.
The `for' loop does the work. It reads lines using `getline' (*note
-Getline::). For an unexpected end of file, it calls the
+Getline::). For an unexpected end-of-file, it calls the
`unexpected_eof()' function. If the line is an "endfile" line, then it
breaks out of the loop. If the line is an `@group' or `@end group'
line, then it ignores it and goes on to the next line. Similarly,
@@ -18458,10 +18537,10 @@ File: gawk.info, Node: Simple Sed, Next: Igawk Program, Prev: Extract Program
11.3.8 A Simple Stream Editor
-----------------------------
-The `sed' utility is a stream editor, a program that reads a stream of
-data, makes changes to it, and passes it on. It is often used to make
-global changes to a large file or to a stream of data generated by a
-pipeline of commands. Although `sed' is a complicated program in its
+The `sed' utility is a "stream editor", a program that reads a stream
+of data, makes changes to it, and passes it on. It is often used to
+make global changes to a large file or to a stream of data generated by
+a pipeline of commands. Although `sed' is a complicated program in its
own right, its most common use is to perform global substitutions in
the middle of a pipeline:
@@ -18575,7 +18654,7 @@ include a library function twice.
`igawk' should behave just like `gawk' externally. This means it
should accept all of `gawk''s command-line arguments, including the
-ability to have multiple source files specified via `-f', and the
+ability to have multiple source files specified via `-f' and the
ability to mix command-line and library source files.
The program is written using the POSIX Shell (`sh') command
@@ -18605,8 +18684,8 @@ language.(1) It works as follows:
file names).
This program uses shell variables extensively: for storing
-command-line arguments, the text of the `awk' program that will expand
-the user's program, for the user's original program, and for the
+command-line arguments and the text of the `awk' program that will
+expand the user's program, for the user's original program, and for the
expanded program. Doing so removes some potential problems that might
arise were we to use temporary files instead, at the cost of making the
script somewhat more complicated.
@@ -18864,7 +18943,7 @@ It's done in these steps:
The last step is to call `gawk' with the expanded program, along
with the original options and command-line arguments that the user
-supplied.
+supplied:
eval gawk $opts -- '"$processed_program"' '"$@"'
@@ -18927,15 +19006,15 @@ One word is an anagram of another if both words contain the same letters
Column 2, Problem C, of Jon Bentley's `Programming Pearls', Second
Edition, presents an elegant algorithm. The idea is to give words that
are anagrams a common signature, sort all the words together by their
-signature, and then print them. Dr. Bentley observes that taking the
-letters in each word and sorting them produces that common signature.
+signatures, and then print them. Dr. Bentley observes that taking the
+letters in each word and sorting them produces those common signatures.
The following program uses arrays of arrays to bring together words
with the same signature and array sorting to print the words in sorted
order:
- # anagram.awk --- An implementation of the anagram finding algorithm
- # from Jon Bentley's "Programming Pearls", 2nd edition.
+ # anagram.awk --- An implementation of the anagram-finding algorithm
+ # from Jon Bentley's "Programming Pearls," 2nd edition.
# Addison Wesley, 2000, ISBN 0-201-65788-0.
# Column 2, Problem C, section 2.8, pp 18-20.
@@ -18955,7 +19034,7 @@ signature; the second dimension is the word itself:
apart into individual letters, sorts the letters, and then joins them
back together:
- # word2key --- split word apart into letters, sort, joining back together
+ # word2key --- split word apart into letters, sort, and join back together
function word2key(word, a, i, n, result)
{
@@ -19053,12 +19132,13 @@ File: gawk.info, Node: Programs Summary, Next: Programs Exercises, Prev: Misc
characters. The ability to use `split()' with the empty string as
the separator can considerably simplify such tasks.
- * The library functions from *note Library Functions::, proved their
- usefulness for a number of real (if small) programs.
+ * The examples here demonstrate the usefulness of the library
+ functions from *note Library Functions::, for a number of real (if
+ small) programs.
* Besides reinventing POSIX wheels, other programs solved a
- selection of interesting problems, such as finding duplicates
- words in text, printing mailing labels, and finding anagrams.
+ selection of interesting problems, such as finding duplicate words
+ in text, printing mailing labels, and finding anagrams.

@@ -19175,16 +19255,16 @@ File: gawk.info, Node: Advanced Features, Next: Internationalization, Prev: S
This major node discusses advanced features in `gawk'. It's a bit
of a "grab bag" of items that are otherwise unrelated to each other.
-First, a command-line option allows `gawk' to recognize nondecimal
-numbers in input data, not just in `awk' programs. Then, `gawk''s
-special features for sorting arrays are presented. Next, two-way I/O,
-discussed briefly in earlier parts of this Info file, is described in
-full detail, along with the basics of TCP/IP networking. Finally,
-`gawk' can "profile" an `awk' program, making it possible to tune it
-for performance.
+First, we look at a command-line option that allows `gawk' to recognize
+nondecimal numbers in input data, not just in `awk' programs. Then,
+`gawk''s special features for sorting arrays are presented. Next,
+two-way I/O, discussed briefly in earlier parts of this Info file, is
+described in full detail, along with the basics of TCP/IP networking.
+Finally, we see how `gawk' can "profile" an `awk' program, making it
+possible to tune it for performance.
- A number of advanced features require separate major nodes of their
-own:
+ Additional advanced features are discussed in separate major nodes
+of their own:
* *note Internationalization::, discusses how to internationalize
your `awk' programs, so that they can speak multiple national
@@ -19258,7 +19338,7 @@ File: gawk.info, Node: Array Sorting, Next: Two-way I/O, Prev: Nondecimal Dat
12.2 Controlling Array Traversal and Array Sorting
==================================================
-`gawk' lets you control the order in which a `for (i in array)' loop
+`gawk' lets you control the order in which a `for (INDX in ARRAY)' loop
traverses an array.
In addition, two built-in functions, `asort()' and `asorti()', let
@@ -19277,9 +19357,9 @@ File: gawk.info, Node: Controlling Array Traversal, Next: Array Sorting Functi
12.2.1 Controlling Array Traversal
----------------------------------
-By default, the order in which a `for (i in array)' loop scans an array
-is not defined; it is generally based upon the internal implementation
-of arrays inside `awk'.
+By default, the order in which a `for (INDX in ARRAY)' loop scans an
+array is not defined; it is generally based upon the internal
+implementation of arrays inside `awk'.
Often, though, it is desirable to be able to loop over the elements
in a particular order that you, the programmer, choose. `gawk' lets
@@ -19301,21 +19381,22 @@ arguments:
RETURN < 0; 0; OR > 0
}
- Here, I1 and I2 are the indices, and V1 and V2 are the corresponding
-values of the two elements being compared. Either V1 or V2, or both,
-can be arrays if the array being traversed contains subarrays as values.
-(*Note Arrays of Arrays::, for more information about subarrays.) The
-three possible return values are interpreted as follows:
+ Here, `i1' and `i2' are the indices, and `v1' and `v2' are the
+corresponding values of the two elements being compared. Either `v1'
+or `v2', or both, can be arrays if the array being traversed contains
+subarrays as values. (*Note Arrays of Arrays::, for more information
+about subarrays.) The three possible return values are interpreted as
+follows:
`comp_func(i1, v1, i2, v2) < 0'
- Index I1 comes before index I2 during loop traversal.
+ Index `i1' comes before index `i2' during loop traversal.
`comp_func(i1, v1, i2, v2) == 0'
- Indices I1 and I2 come together but the relative order with
+ Indices `i1' and `i2' come together, but the relative order with
respect to each other is undefined.
`comp_func(i1, v1, i2, v2) > 0'
- Index I1 comes after index I2 during loop traversal.
+ Index `i1' comes after index `i2' during loop traversal.
Our first comparison function can be used to scan an array in
numerical order of the indices:
@@ -19458,7 +19539,7 @@ elements compare equal. This is usually not a problem, but letting the
tied elements come out in arbitrary order can be an issue, especially
when comparing item values. The partial ordering of the equal elements
may change the next time the array is traversed, if other elements are
-added or removed from the array. One way to resolve ties when
+added to or removed from the array. One way to resolve ties when
comparing elements with otherwise equal values is to include the
indices in the comparison rules. Note that doing this may make the
loop traversal less efficient, so consider it only if necessary. The
@@ -19492,14 +19573,14 @@ lowercase letters as equivalent or distinct.
Another point to keep in mind is that in the case of subarrays, the
element values can themselves be arrays; a production comparison
-function should use the `isarray()' function (*note Type Functions::),
+function should use the `isarray()' function (*note Type Functions::)
to check for this, and choose a defined sorting order for subarrays.
All sorting based on `PROCINFO["sorted_in"]' is disabled in POSIX
mode, because the `PROCINFO' array is not special in that case.
As a side note, sorting the array indices before traversing the
-array has been reported to add 15% to 20% overhead to the execution
+array has been reported to add a 15% to 20% overhead to the execution
time of `awk' programs. For this reason, sorted array traversal is not
the default.
@@ -19548,8 +19629,8 @@ array is not affected.
Often, what's needed is to sort on the values of the _indices_
instead of the values of the elements. To do that, use the `asorti()'
function. The interface and behavior are identical to that of
-`asort()', except that the index values are used for sorting, and
-become the values of the result array:
+`asort()', except that the index values are used for sorting and become
+the values of the result array:
{ source[$0] = some_func($0) }
@@ -19581,8 +19662,8 @@ chooses_, taking into account just the indices, just the values, or
both. This is extremely powerful.
Once the array is sorted, `asort()' takes the _values_ in their
-final order, and uses them to fill in the result array, whereas
-`asorti()' takes the _indices_ in their final order, and uses them to
+final order and uses them to fill in the result array, whereas
+`asorti()' takes the _indices_ in their final order and uses them to
fill in the result array.
NOTE: Copying array indices and elements isn't expensive in terms
@@ -19780,7 +19861,7 @@ REMOTE-PORT
name.
NOTE: Failure in opening a two-way socket will result in a
- non-fatal error being returned to the calling code. The value of
+ nonfatal error being returned to the calling code. The value of
`ERRNO' indicates the error (*note Auto-set::).
Consider the following very simple example:
@@ -19861,8 +19942,8 @@ First, the `awk' program:
junk
Here is the `awkprof.out' that results from running the `gawk'
-profiler on this program and data. (This example also illustrates that
-`awk' programmers sometimes get up very early in the morning to work.)
+profiler on this program and data (this example also illustrates that
+`awk' programmers sometimes get up very early in the morning to work):
# gawk profile, created Mon Sep 29 05:16:21 2014
@@ -19915,7 +19996,7 @@ profiler on this program and data. (This example also illustrates that
output. They are as follows:
* The program is printed in the order `BEGIN' rules, `BEGINFILE'
- rules, pattern/action rules, `ENDFILE' rules, `END' rules and
+ rules, pattern-action rules, `ENDFILE' rules, `END' rules, and
functions, listed alphabetically. Multiple `BEGIN' and `END'
rules retain their separate identities, as do multiple `BEGINFILE'
and `ENDFILE' rules.
@@ -19960,13 +20041,13 @@ output. They are as follows:
scalar, it gets parenthesized.
* `gawk' supplies leading comments in front of the `BEGIN' and `END'
- rules, the `BEGINFILE' and `ENDFILE' rules, the pattern/action
+ rules, the `BEGINFILE' and `ENDFILE' rules, the pattern-action
rules, and the functions.
The profiled version of your program may not look exactly like what
you typed when you wrote it. This is because `gawk' creates the
-profiled version by "pretty printing" its internal representation of
+profiled version by "pretty-printing" its internal representation of
the program. The advantage to this is that `gawk' can produce a
standard representation. Also, things such as:
@@ -20016,15 +20097,15 @@ output profile file.
produces the profile and the function call trace and then exits.
When `gawk' runs on MS-Windows systems, it uses the `INT' and `QUIT'
-signals for producing the profile and, in the case of the `INT' signal,
+signals for producing the profile, and in the case of the `INT' signal,
`gawk' exits. This is because these systems don't support the `kill'
command, so the only signals you can deliver to a program are those
generated by the keyboard. The `INT' signal is generated by the
-`Ctrl-<C>' or `Ctrl-<BREAK>' key, while the `QUIT' signal is generated
-by the `Ctrl-<\>' key.
+`Ctrl-c' or `Ctrl-BREAK' key, while the `QUIT' signal is generated by
+the `Ctrl-\' key.
Finally, `gawk' also accepts another option, `--pretty-print'. When
-called this way, `gawk' "pretty prints" the program into `awkprof.out',
+called this way, `gawk' "pretty-prints" the program into `awkprof.out',
without any execution counts.
NOTE: Once upon a time, the `--pretty-print' option would also run
@@ -20076,7 +20157,7 @@ File: gawk.info, Node: Advanced Features Summary, Prev: Profiling, Up: Advanc
two-way communications.
* By using special file names with the `|&' operator, you can open a
- TCP/IP (or UDP/IP) connection to remote hosts in the Internet.
+ TCP/IP (or UDP/IP) connection to remote hosts on the Internet.
`gawk' supports both IPv4 and IPv6.
* You can generate statement count profiles of your program. This
@@ -20085,7 +20166,7 @@ File: gawk.info, Node: Advanced Features Summary, Prev: Profiling, Up: Advanc
`USR1' signal while profiling causes `gawk' to dump the profile
and keep going, including a function call stack.
- * You can also just "pretty print" the program. This currently also
+ * You can also just "pretty-print" the program. This currently also
runs the program, but that will change in the next major release.
@@ -20129,7 +20210,7 @@ File: gawk.info, Node: I18N and L10N, Next: Explaining gettext, Up: Internati
"Internationalization" means writing (or modifying) a program once, in
such a way that it can use multiple languages without requiring further
-source-code changes. "Localization" means providing the data necessary
+source code changes. "Localization" means providing the data necessary
for an internationalized program to work in a particular language.
Most typically, these terms refer to features such as the language used
for printing error messages, the language used to read responses, and
@@ -20143,7 +20224,7 @@ File: gawk.info, Node: Explaining gettext, Next: Programmer i18n, Prev: I18N
==================
`gawk' uses GNU `gettext' to provide its internationalization features.
-The facilities in GNU `gettext' focus on messages; strings printed by a
+The facilities in GNU `gettext' focus on messages: strings printed by a
program, either directly or via formatting with `printf' or
`sprintf()'.(1)
@@ -20272,8 +20353,7 @@ File: gawk.info, Node: Programmer i18n, Next: Translator i18n, Prev: Explaini
13.3 Internationalizing `awk' Programs
======================================
-`gawk' provides the following variables and functions for
-internationalization:
+`gawk' provides the following variables for internationalization:
`TEXTDOMAIN'
This variable indicates the application's text domain. For
@@ -20285,6 +20365,8 @@ internationalization:
for translation at runtime. String constants without a leading
underscore are not translated.
+ `gawk' provides the following functions for internationalization:
+
``dcgettext(STRING' [`,' DOMAIN [`,' CATEGORY]]`)''
Return the translation of STRING in text domain DOMAIN for locale
category CATEGORY. The default value for DOMAIN is the current
@@ -20323,8 +20405,7 @@ internationalization:
the null string (`""'), then `bindtextdomain()' returns the
current binding for the given DOMAIN.
- To use these facilities in your `awk' program, follow the steps
-outlined in *note Explaining gettext::, like so:
+ To use these facilities in your `awk' program, follow these steps:
1. Set the variable `TEXTDOMAIN' to the text domain of your program.
This is best done in a `BEGIN' rule (*note BEGIN/END::), or it can
@@ -20546,7 +20627,7 @@ actually almost portable, requiring very little change:
its value, leaving the original string constant as the result.
* By defining "dummy" functions to replace `dcgettext()',
- `dcngettext()' and `bindtextdomain()', the `awk' program can be
+ `dcngettext()', and `bindtextdomain()', the `awk' program can be
made to run, but all the messages are output in the original
language. For example:
@@ -20681,8 +20762,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.4
+`gettext' utilities)Top:: gettext, GNU `gettext' utilities.) As of
+this 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
@@ -20695,7 +20776,7 @@ File: gawk.info, Node: I18N Summary, Prev: Gawk I18N, Up: Internationalizatio
============
* Internationalization means writing a program such that it can use
- multiple languages without requiring source-code changes.
+ multiple languages without requiring source code changes.
Localization means providing the data necessary for an
internationalized program to work in a particular language.
@@ -20709,10 +20790,10 @@ File: gawk.info, Node: I18N Summary, Prev: Gawk I18N, Up: Internationalizatio
file, and the `.po' files are compiled into `.gmo' files for use
at runtime.
- * You can use position specifications with `sprintf()' and `printf'
- to rearrange the placement of argument values in formatted strings
- and output. This is useful for the translations of format control
- strings.
+ * You can use positional specifications with `sprintf()' and
+ `printf' to rearrange the placement of argument values in formatted
+ strings and output. This is useful for the translation of format
+ control strings.
* The internationalization features have been designed so that they
can be easily worked around in a standard `awk'.
@@ -20768,8 +20849,7 @@ File: gawk.info, Node: Debugging Concepts, Next: Debugging Terms, Up: Debuggi
---------------------------
(If you have used debuggers in other languages, you may want to skip
-ahead to the next section on the specific features of the `gawk'
-debugger.)
+ahead to *note Awk Debugging::.)
Of course, a debugging program cannot remove bugs for you, because
it has no way of knowing what you or your users consider a "bug" versus
@@ -20856,11 +20936,11 @@ defines terms used throughout the rest of this major node:

File: gawk.info, Node: Awk Debugging, Prev: Debugging Terms, Up: Debugging
-14.1.3 Awk Debugging
---------------------
+14.1.3 `awk' Debugging
+----------------------
Debugging an `awk' program has some specific aspects that are not
-shared with other programming languages.
+shared with programs written in other languages.
First of all, the fact that `awk' programs usually take input line
by line from a file or files and operate on those lines using specific
@@ -20878,8 +20958,8 @@ commands.

File: gawk.info, Node: Sample Debugging Session, Next: List of Debugger Commands, Prev: Debugging, Up: Debugger
-14.2 Sample Debugging Session
-=============================
+14.2 Sample `gawk' Debugging Session
+====================================
In order to illustrate the use of `gawk' as a debugger, let's look at a
sample debugging session. We will use the `awk' implementation of the
@@ -20898,8 +20978,8 @@ File: gawk.info, Node: Debugger Invocation, Next: Finding The Bug, Up: Sample
--------------------------------
Starting the debugger is almost exactly like running `gawk' normally,
-except you have to pass an additional option `--debug', or the
-corresponding short option `-D'. The file(s) containing the program
+except you have to pass an additional option, `--debug', or the
+corresponding short option, `-D'. The file(s) containing the program
and any supporting code are given on the command line as arguments to
one or more `-f' options. (`gawk' is not designed to debug command-line
programs, only programs contained in files.) In our case, we invoke
@@ -20909,7 +20989,7 @@ the debugger like this:
where both `getopt.awk' and `uniq.awk' are in `$AWKPATH'. (Experienced
users of GDB or similar debuggers should note that this syntax is
-slightly different from what they are used to. With the `gawk'
+slightly different from what you are used to. With the `gawk'
debugger, you give the arguments for running the program in the command
line to the debugger rather than as part of the `run' command at the
debugger prompt.) The `-1' is an option to `uniq.awk'.
@@ -21033,10 +21113,10 @@ typing `n' (for "next"):
-| 66 if (fcount > 0) {
This tells us that `gawk' is now ready to execute line 66, which
-decides whether to give the lines the special "field skipping" treatment
+decides whether to give the lines the special "field-skipping" treatment
indicated by the `-1' command-line option. (Notice that we skipped
-from where we were before at line 63 to here, because the condition in
-line 63 `if (fcount == 0 && charcount == 0)' was false.)
+from where we were before, at line 63, to here, because the condition
+in line 63, `if (fcount == 0 && charcount == 0)', was false.)
Continuing to step, we now get to the splitting of the current and
last records:
@@ -21094,15 +21174,15 @@ mentioned):
Well, here we are at our error (sorry to spoil the suspense). What
we had in mind was to join the fields starting from the second one to
-make the virtual record to compare, and if the first field was numbered
-zero, this would work. Let's look at what we've got:
+make the virtual record to compare, and if the first field were
+numbered zero, this would work. Let's look at what we've got:
gawk> p cline clast
-| cline = "gawk is a wonderful program!"
-| clast = "awk is a wonderful program!"
Hey, those look pretty familiar! They're just our original,
-unaltered, input records. A little thinking (the human brain is still
+unaltered input records. A little thinking (the human brain is still
the best debugging tool), and we realize that we were off by one!
We get out of the debugger:
@@ -21139,11 +21219,11 @@ categories:
* Miscellaneous
Each of these are discussed in the following subsections. In the
-following descriptions, commands which may be abbreviated show the
+following descriptions, commands that may be abbreviated show the
abbreviation on a second description line. A debugger command name may
also be truncated if that partial name is unambiguous. The debugger has
the built-in capability to automatically repeat the previous command
-just by hitting <Enter>. This works for the commands `list', `next',
+just by hitting `Enter'. This works for the commands `list', `next',
`nexti', `step', `stepi', and `continue' executed without any argument.
* Menu:
@@ -21183,8 +21263,8 @@ The commands for controlling breakpoints are:
Set a breakpoint at entry to (the first instruction of)
function FUNCTION.
- Each breakpoint is assigned a number which can be used to delete
- it from the breakpoint list using the `delete' command.
+ Each breakpoint is assigned a number that can be used to delete it
+ from the breakpoint list using the `delete' command.
With a breakpoint, you may also supply a condition. This is an
`awk' expression (enclosed in double quotes) that the debugger
@@ -21222,26 +21302,26 @@ The commands for controlling breakpoints are:
`delete' [N1 N2 ...] [N-M]
`d' [N1 N2 ...] [N-M]
- Delete specified breakpoints or a range of breakpoints. Deletes
- all defined breakpoints if no argument is supplied.
+ Delete specified breakpoints or a range of breakpoints. Delete all
+ defined breakpoints if no argument is supplied.
`disable' [N1 N2 ... | N-M]
Disable specified breakpoints or a range of breakpoints. Without
- any argument, disables all breakpoints.
+ any argument, disable all breakpoints.
`enable' [`del' | `once'] [N1 N2 ...] [N-M]
`e' [`del' | `once'] [N1 N2 ...] [N-M]
Enable specified breakpoints or a range of breakpoints. Without
- any argument, enables all breakpoints. Optionally, you can
- specify how to enable the breakpoint:
+ any argument, enable all breakpoints. Optionally, you can specify
+ how to enable the breakpoints:
`del'
- Enable the breakpoint(s) temporarily, then delete it when the
- program stops at the breakpoint.
+ Enable the breakpoints temporarily, then delete each one when
+ the program stops at it.
`once'
- Enable the breakpoint(s) temporarily, then disable it when
- the program stops at the breakpoint.
+ Enable the breakpoints temporarily, then disable each one when
+ the program stops at it.
`ignore' N COUNT
Ignore breakpoint number N the next COUNT times it is hit.
@@ -21287,7 +21367,7 @@ execution of the program than we saw in our earlier example:
`continue' [COUNT]
`c' [COUNT]
Resume program execution. If continued from a breakpoint and COUNT
- is specified, ignores the breakpoint at that location the next
+ is specified, ignore the breakpoint at that location the next
COUNT times before stopping.
`finish'
@@ -21322,10 +21402,10 @@ execution of the program than we saw in our earlier example:
`step' [COUNT]
`s' [COUNT]
Continue execution until control reaches a different source line
- in the current stack frame. `step' steps inside any function
- called within the line. If the argument COUNT is supplied, steps
- that many times before stopping, unless it encounters a breakpoint
- or watchpoint.
+ in the current stack frame, stepping inside any function called
+ within the line. If the argument COUNT is supplied, steps that
+ many times before stopping, unless it encounters a breakpoint or
+ watchpoint.
`stepi' [COUNT]
`si' [COUNT]
@@ -21406,13 +21486,13 @@ AWK STATEMENTS
(`"'...`"').
You can also set special `awk' variables, such as `FS', `NF',
- `NR', and son on.
+ `NR', and so on.
`watch' VAR | `$'N [`"EXPRESSION"']
`w' VAR | `$'N [`"EXPRESSION"']
Add variable VAR (or field `$N') to the watch list. The debugger
then stops whenever the value of the variable or field changes.
- Each watched item is assigned a number which can be used to delete
+ Each watched item is assigned a number that can be used to delete
it from the watch list using the `unwatch' command.
With a watchpoint, you may also supply a condition. This is an
@@ -21436,11 +21516,11 @@ File: gawk.info, Node: Execution Stack, Next: Debugger Info, Prev: Viewing An
14.3.4 Working with the Stack
-----------------------------
-Whenever you run a program which contains any function calls, `gawk'
+Whenever you run a program that contains any function calls, `gawk'
maintains a stack of all of the function calls leading up to where the
program is right now. You can see how you got to where you are, and
also move around in the stack to see what the state of things was in the
-functions which called the one you are in. The commands for doing this
+functions that called the one you are in. The commands for doing this
are:
`backtrace' [COUNT]
@@ -21460,8 +21540,8 @@ are:
`frame' [N]
`f' [N]
Select and print stack frame N. Frame 0 is the currently
- executing, or "innermost", frame (function call), frame 1 is the
- frame that called the innermost one. The highest numbered frame is
+ executing, or "innermost", frame (function call); frame 1 is the
+ frame that called the innermost one. The highest-numbered frame is
the one for the main program. The printed information consists of
the frame number, function and argument names, source file, and
the source line.
@@ -21478,7 +21558,7 @@ File: gawk.info, Node: Debugger Info, Next: Miscellaneous Debugger Commands,
Besides looking at the values of variables, there is often a need to get
other sorts of information about the state of your program and of the
-debugging environment itself. The `gawk' debugger has one command which
+debugging environment itself. The `gawk' debugger has one command that
provides this information, appropriately called `info'. `info' is used
with one of a number of arguments that tell it exactly what you want to
know:
@@ -21535,11 +21615,12 @@ from a file. The commands are:
option. The available options are:
`history_size'
- The maximum number of lines to keep in the history file
+ Set the maximum number of lines to keep in the history file
`./.gawk_history'. The default is 100.
`listsize'
- The number of lines that `list' prints. The default is 15.
+ Specify the number of lines that `list' prints. The default
+ is 15.
`outfile'
Send `gawk' output to a file; debugger output still goes to
@@ -21547,7 +21628,7 @@ from a file. The commands are:
standard output.
`prompt'
- The debugger prompt. The default is `gawk> '.
+ Change the debugger prompt. The default is `gawk> '.
`save_history' [`on' | `off']
Save command history to file `./.gawk_history'. The default
@@ -21555,8 +21636,8 @@ from a file. The commands are:
`save_options' [`on' | `off']
Save current options to file `./.gawkrc' upon exit. The
- default is `on'. Options are read back in to the next
- session upon startup.
+ default is `on'. Options are read back into the next session
+ upon startup.
`trace' [`on' | `off']
Turn instruction tracing on or off. The default is `off'.
@@ -21575,7 +21656,7 @@ from a file. The commands are:
commands; however, the `gawk' debugger will not source the same
file more than once in order to avoid infinite recursion.
- In addition to, or instead of the `source' command, you can use
+ In addition to, or instead of, the `source' command, you can use
the `-D FILE' or `--debug=FILE' command-line options to execute
commands from a file non-interactively (*note Options::).
@@ -21585,13 +21666,13 @@ File: gawk.info, Node: Miscellaneous Debugger Commands, Prev: Debugger Info,
14.3.6 Miscellaneous Commands
-----------------------------
-There are a few more commands which do not fit into the previous
+There are a few more commands that do not fit into the previous
categories, as follows:
`dump' [FILENAME]
- Dump bytecode of the program to standard output or to the file
+ Dump byte code of the program to standard output or to the file
named in FILENAME. This prints a representation of the internal
- instructions which `gawk' executes to implement the `awk' commands
+ instructions that `gawk' executes to implement the `awk' commands
in a program. This can be very enlightening, as the following
partial dump of Davide Brini's obfuscated code (*note Signature
Program::) demonstrates:
@@ -21675,22 +21756,21 @@ categories, as follows:
FILENAME. This command may change the current source file.
FUNCTION
- Print lines centered around beginning of the function
+ Print lines centered around the beginning of the function
FUNCTION. This command may change the current source file.
`quit'
`q'
Exit the debugger. Debugging is great fun, but sometimes we all
have to tend to other obligations in life, and sometimes we find
- the bug, and are free to go on to the next one! As we saw
- earlier, if you are running a program, the debugger warns you if
- you accidentally type `q' or `quit', to make sure you really want
- to quit.
+ the bug and are free to go on to the next one! As we saw earlier,
+ if you are running a program, the debugger warns you when you type
+ `q' or `quit', to make sure you really want to quit.
`trace' [`on' | `off']
- Turn on or off a continuous printing of instructions which are
- about to be executed, along with printing the `awk' line which they
- implement. The default is `off'.
+ Turn on or off continuous printing of the instructions that are
+ about to be executed, along with the `awk' lines they implement.
+ The default is `off'.
It is to be hoped that most of the "opcodes" in these instructions
are fairly self-explanatory, and using `stepi' and `nexti' while
@@ -21703,7 +21783,7 @@ File: gawk.info, Node: Readline Support, Next: Limitations, Prev: List of Deb
14.4 Readline Support
=====================
-If `gawk' is compiled with the `readline' library
+If `gawk' is compiled with the GNU Readline library
(http://cnswww.cns.cwru.edu/php/chet/readline/readline.html), you can
take advantage of that library's command completion and history
expansion features. The following types of completion are available:
@@ -21733,7 +21813,7 @@ File: gawk.info, Node: Limitations, Next: Debugging Summary, Prev: Readline S
We hope you find the `gawk' debugger useful and enjoyable to work with,
but as with any program, especially in its early releases, it still has
-some limitations. A few which are worth being aware of are:
+some limitations. A few that it's worth being aware of are:
* At this point, the debugger does not give a detailed explanation of
what you did wrong when you type in something it doesn't like.
@@ -21744,13 +21824,13 @@ some limitations. A few which are worth being aware of are:
Commands:: (or if you are already familiar with `gawk' internals),
you will realize that much of the internal manipulation of data in
`gawk', as in many interpreters, is done on a stack. `Op_push',
- `Op_pop', and the like, are the "bread and butter" of most `gawk'
+ `Op_pop', and the like are the "bread and butter" of most `gawk'
code.
Unfortunately, as of now, the `gawk' debugger does not allow you
to examine the stack's contents. That is, the intermediate
results of expression evaluation are on the stack, but cannot be
- printed. Rather, only variables which are defined in the program
+ printed. Rather, only variables that are defined in the program
can be printed. Of course, a workaround for this is to use more
explicit variables at the debugging stage and then change back to
obscure, perhaps more optimal code later.
@@ -21762,12 +21842,12 @@ some limitations. A few which are worth being aware of are:
* The `gawk' debugger is designed to be used by running a program
(with all its parameters) on the command line, as described in
*note Debugger Invocation::. There is no way (as of now) to
- attach or "break in" to a running program. This seems reasonable
- for a language which is used mainly for quickly executing, short
+ attach or "break into" a running program. This seems reasonable
+ for a language that is used mainly for quickly executing, short
programs.
- * The `gawk' debugger only accepts source supplied with the `-f'
- option.
+ * The `gawk' debugger only accepts source code supplied with the
+ `-f' option.

File: gawk.info, Node: Debugging Summary, Prev: Limitations, Up: Debugger
@@ -21776,8 +21856,8 @@ File: gawk.info, Node: Debugging Summary, Prev: Limitations, Up: Debugger
============
* Programs rarely work correctly the first time. Finding bugs is
- "debugging" and a program that helps you find bugs is a
- "debugger". `gawk' has a built-in debugger that works very
+ called debugging, and a program that helps you find bugs is a
+ debugger. `gawk' has a built-in debugger that works very
similarly to the GNU Debugger, GDB.
* Debuggers let you step through your program one statement at a
@@ -21793,8 +21873,8 @@ File: gawk.info, Node: Debugging Summary, Prev: Limitations, Up: Debugger
breakpoints, execution, viewing and changing data, working with
the stack, getting information, and other tasks.
- * If the `readline' library is available when `gawk' is compiled, it
- is used by the debugger to provide command-line history and
+ * If the GNU Readline library is available when `gawk' is compiled,
+ it is used by the debugger to provide command-line history and
editing.
@@ -21855,7 +21935,7 @@ Decimal arithmetic
sides) of the decimal point, and the results of a computation are
always exact.
- Some modern system can do decimal arithmetic in hardware, but
+ Some modern systems can do decimal arithmetic in hardware, but
usually you need a special software library to provide access to
these instructions. There are also libraries that do decimal
arithmetic entirely in software.
@@ -21871,8 +21951,7 @@ Integer arithmetic
In computers, integer values come in two flavors: "signed" and
"unsigned". Signed values may be negative or positive, whereas
- unsigned values are always positive (i.e., greater than or equal
- to zero).
+ unsigned values are always greater than or equal to zero.
In computer systems, integer arithmetic is exact, but the possible
range of values is limited. Integer arithmetic is generally
@@ -21909,12 +21988,6 @@ Numeric representation Minimum value Maximum value
32-bit unsigned integer 0 4,294,967,295
64-bit signed integer -9,223,372,036,854,775,8089,223,372,036,854,775,807
64-bit unsigned integer 0 18,446,744,073,709,551,615
-Single-precision `1.175494e-38' `3.402823e+38'
-floating point
-(approximate)
-Double-precision `2.225074e-308' `1.797693e+308'
-floating point
-(approximate)
Table 15.1: Value ranges for different numeric representations
@@ -21930,7 +22003,7 @@ File: gawk.info, Node: Math Definitions, Next: MPFR features, Prev: Computer
The rest of this major node uses a number of terms. Here are some
informal definitions that should help you work your way through the
-material here.
+material here:
"Accuracy"
A floating-point calculation's accuracy is how close it comes to
@@ -21950,7 +22023,7 @@ material here.
number and infinity produce infinity.
"NaN"
- "Not A Number."(1) A special value that results from attempting a
+ "Not a number."(1) A special value that results from attempting a
calculation that has no answer as a real number. In such a case,
programs can either receive a floating-point exception, or get
`NaN' back as the result. The IEEE 754 standard recommends that
@@ -21976,15 +22049,15 @@ material here.
PREC = 3.322 * DPS
- Here, PREC denotes the binary precision (measured in bits) and DPS
- (short for decimal places) is the decimal digits.
+ Here, _prec_ denotes the binary precision (measured in bits) and
+ _dps_ (short for decimal places) is the decimal digits.
"Rounding mode"
How numbers are rounded up or down when necessary. More details
are provided later.
"Significand"
- A floating-point value consists the significand multiplied by 10
+ A floating-point value consists of the significand multiplied by 10
to the power of the exponent. For example, in `1.2345e67', the
significand is `1.2345'.
@@ -22006,7 +22079,7 @@ precision formats to allow greater precisions and larger exponent
ranges. (`awk' uses only the 64-bit double-precision format.)
*note table-ieee-formats:: lists the precision and exponent field
-values for the basic IEEE 754 binary formats:
+values for the basic IEEE 754 binary formats.
Name Total bits Precision Minimum Maximum
exponent exponent
@@ -22071,7 +22144,7 @@ File: gawk.info, Node: FP Math Caution, Next: Arbitrary Precision Integers, P
Math class is tough! -- Teen Talk Barbie, July 1992
- This minor node provides a high level overview of the issues
+ This minor node provides a high-level overview of the issues
involved when doing lots of floating-point arithmetic.(1) The
discussion applies to both hardware and arbitrary-precision
floating-point arithmetic.
@@ -22092,8 +22165,8 @@ floating-point arithmetic.
(1) There is a very nice paper on floating-point arithmetic
(http://www.validlab.com/goldberg/paper.pdf) by David Goldberg, "What
-Every Computer Scientist Should Know About Floating-point Arithmetic,"
-`ACM Computing Surveys' *23*, 1 (1991-03), 5-48. This is worth reading
+Every Computer Scientist Should Know About Floating-Point Arithmetic,"
+`ACM Computing Surveys' *23*, 1 (1991-03): 5-48. This is worth reading
if you are interested in the details, but it does require a background
in computer science.
@@ -22147,7 +22220,7 @@ number as you assigned to it:
Often the error is so small you do not even notice it, and if you do,
you can always specify how much precision you would like in your output.
-Usually this is a format string like `"%.15g"', which when used in the
+Usually this is a format string like `"%.15g"', which, when used in the
previous example, produces an output identical to the input.

@@ -22187,7 +22260,7 @@ File: gawk.info, Node: Errors accumulate, Prev: Comparing FP Values, Up: Inex
The loss of accuracy during a single computation with floating-point
numbers usually isn't enough to worry about. However, if you compute a
-value which is the result of a sequence of floating-point operations,
+value that is the result of a sequence of floating-point operations,
the error can accumulate and greatly affect the computation itself.
Here is an attempt to compute the value of pi using one of its many
series representations:
@@ -22238,7 +22311,7 @@ easy answers. The standard rules of algebra often do not apply when
using floating-point arithmetic. Among other things, the distributive
and associative laws do not hold completely, and order of operation may
be important for your computation. Rounding error, cumulative precision
-loss and underflow are often troublesome.
+loss, and underflow are often troublesome.
When `gawk' tests the expressions `0.1 + 12.2' and `12.3' for
equality using the machine double-precision arithmetic, it decides that
@@ -22273,8 +22346,9 @@ illustrated by our earlier attempt to compute the value of pi. Extra
precision can greatly enhance the stability and the accuracy of your
computation in such cases.
- Repeated addition is not necessarily equivalent to multiplication in
-floating-point arithmetic. In the example in *note Errors accumulate:::
+ Additionally, you should understand that repeated addition is not
+necessarily equivalent to multiplication in floating-point arithmetic.
+In the example in *note Errors accumulate:::
$ gawk 'BEGIN {
> for (d = 1.1; d <= 1.5; d += 0.1) # loop five times (?)
@@ -22329,7 +22403,7 @@ set the value to one of the predefined case-insensitive strings shown
in *note table-predefined-precision-strings::, to emulate an IEEE 754
binary format.
-`PREC' IEEE 754 Binary Format
+`PREC' IEEE 754 binary format
---------------------------------------------------
`"half"' 16-bit half-precision
`"single"' Basic 32-bit single precision
@@ -22362,14 +22436,14 @@ on arithmetic operations:
example illustrates the differences among various ways to print a
floating-point constant:
- $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 0.1) }'
- -| 0.1000000000000000055511151
- $ gawk -M -v PREC=113 'BEGIN { printf("%0.25f\n", 0.1) }'
- -| 0.1000000000000000000000000
- $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", "0.1") }'
- -| 0.1000000000000000000000000
- $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 1/10) }'
- -| 0.1000000000000000000000000
+ $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 0.1) }'
+ -| 0.1000000000000000055511151
+ $ gawk -M -v PREC=113 'BEGIN { printf("%0.25f\n", 0.1) }'
+ -| 0.1000000000000000000000000
+ $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", "0.1") }'
+ -| 0.1000000000000000000000000
+ $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 1/10) }'
+ -| 0.1000000000000000000000000

File: gawk.info, Node: Setting the rounding mode, Prev: Setting precision, Up: FP Math Caution
@@ -22377,15 +22451,15 @@ File: gawk.info, Node: Setting the rounding mode, Prev: Setting precision, Up
15.4.5 Setting the Rounding Mode
--------------------------------
-The `ROUNDMODE' variable provides program level control over the
+The `ROUNDMODE' variable provides program-level control over the
rounding mode. The correspondence between `ROUNDMODE' and the IEEE
rounding modes is shown in *note table-gawk-rounding-modes::.
-Rounding Mode IEEE Name `ROUNDMODE'
+Rounding mode IEEE name `ROUNDMODE'
---------------------------------------------------------------------------
Round to nearest, ties to even `roundTiesToEven' `"N"' or `"n"'
-Round toward plus Infinity `roundTowardPositive' `"U"' or `"u"'
-Round toward negative Infinity `roundTowardNegative' `"D"' or `"d"'
+Round toward positive infinity `roundTowardPositive' `"U"' or `"u"'
+Round toward negative infinity `roundTowardNegative' `"D"' or `"d"'
Round toward zero `roundTowardZero' `"Z"' or `"z"'
Round to nearest, ties away `roundTiesToAway' `"A"' or `"a"'
from zero
@@ -22436,8 +22510,8 @@ distributes upward and downward rounds of exact halves, which might
cause any accumulating round-off error to cancel itself out. This is the
default rounding mode for IEEE 754 computing functions and operators.
- The other rounding modes are rarely used. Round toward positive
-infinity (`roundTowardPositive') and round toward negative infinity
+ The other rounding modes are rarely used. Rounding toward positive
+infinity (`roundTowardPositive') and toward negative infinity
(`roundTowardNegative') are often used to implement interval
arithmetic, where you adjust the rounding mode to calculate upper and
lower bounds for the range of output. The `roundTowardZero' mode can be
@@ -22485,7 +22559,7 @@ floating-point values:
If instead you were to compute the same value using
arbitrary-precision floating-point values, the precision needed for
-correct output (using the formula `prec = 3.322 * dps'), would be 3.322
+correct output (using the formula `prec = 3.322 * dps') would be 3.322
x 183231, or 608693.
The result from an arithmetic operation with an integer and a
@@ -22516,7 +22590,7 @@ interface to process arbitrary-precision integers or mixed-mode numbers
as needed by an operation or function. In such a case, the precision is
set to the minimum value necessary for exact conversion, and the working
precision is not used for this purpose. If this is not what you need or
-want, you can employ a subterfuge, and convert the integer to floating
+want, you can employ a subterfuge and convert the integer to floating
point first, like this:
gawk -M 'BEGIN { n = 13; print (n + 0.0) % 2.0 }'
@@ -22599,7 +22673,7 @@ File: gawk.info, Node: POSIX Floating Point Problems, Next: Floating point sum
15.6 Standards Versus Existing Practice
=======================================
-Historically, `awk' has converted any non-numeric looking string to the
+Historically, `awk' has converted any nonnumeric-looking string to the
numeric value zero, when required. Furthermore, the original
definition of the language and the original POSIX standards specified
that `awk' only understands decimal numbers (base 10), and not octal
@@ -22613,8 +22687,8 @@ These features are:
hexadecimal notation (e.g., `0xDEADBEEF'). (Note: data values,
_not_ source code constants.)
- * Support for the special IEEE 754 floating-point values "Not A
- Number" (NaN), positive Infinity ("inf"), and negative Infinity
+ * Support for the special IEEE 754 floating-point values "not a
+ number" (NaN), positive infinity ("inf"), and negative infinity
("-inf"). In particular, the format for these values is as
specified by the ISO 1999 C standard, which ignores case and can
allow implementation-dependent additional characters after the
@@ -22631,21 +22705,21 @@ historical practice:
values is also a very severe departure from historical practice.
The second problem is that the `gawk' maintainer feels that this
-interpretation of the standard, which requires a certain amount of
+interpretation of the standard, which required a certain amount of
"language lawyering" to arrive at in the first place, was not even
-intended by the standard developers. In other words, "we see how you
+intended by the standard developers. In other words, "We see how you
got where you are, but we don't think that that's where you want to be."
Recognizing these issues, but attempting to provide compatibility
with the earlier versions of the standard, the 2008 POSIX standard
added explicit wording to allow, but not require, that `awk' support
-hexadecimal floating-point values and special values for "Not A Number"
+hexadecimal floating-point values and special values for "not a number"
and infinity.
Although the `gawk' maintainer continues to feel that providing
those features is inadvisable, nevertheless, on systems that support
IEEE floating point, it seems reasonable to provide _some_ way to
-support NaN and Infinity values. The solution implemented in `gawk' is
+support NaN and infinity values. The solution implemented in `gawk' is
as follows:
* With the `--posix' command-line option, `gawk' becomes "hands
@@ -22660,7 +22734,7 @@ as follows:
$ echo 0xDeadBeef | gawk --posix '{ print $1 + 0 }'
-| 3735928559
- * Without `--posix', `gawk' interprets the four strings `+inf',
+ * Without `--posix', `gawk' interprets the four string values `+inf',
`-inf', `+nan', and `-nan' specially, producing the corresponding
special numeric values. The leading sign acts a signal to `gawk'
(and the user) that the value is really numeric. Hexadecimal
@@ -22674,7 +22748,7 @@ as follows:
$ echo 0xDeadBeef | gawk '{ print $1 + 0 }'
-| 0
- `gawk' ignores case in the four special values. Thus `+nan' and
+ `gawk' ignores case in the four special values. Thus, `+nan' and
`+NaN' are the same.
---------- Footnotes ----------
@@ -22691,9 +22765,9 @@ File: gawk.info, Node: Floating point summary, Prev: POSIX Floating Point Prob
floating-point values. Standard `awk' uses double-precision
floating-point values.
- * In the early 1990s, Barbie mistakenly said "Math class is tough!"
+ * In the early 1990s Barbie mistakenly said, "Math class is tough!"
Although math isn't tough, floating-point arithmetic isn't the same
- as pencil and paper math, and care must be taken:
+ as pencil-and-paper math, and care must be taken:
- Not all numbers can be represented exactly.
@@ -22714,18 +22788,18 @@ File: gawk.info, Node: Floating point summary, Prev: POSIX Floating Point Prob
rounding mode.
* With `-M', `gawk' performs arbitrary-precision integer arithmetic
- using the GMP library. This is faster and more space efficient
+ using the GMP library. This is faster and more space-efficient
than using MPFR for the same calculations.
- * There are several "dark corners" with respect to floating-point
- numbers where `gawk' disagrees with the POSIX standard. It pays
- to be aware of them.
+ * There are several areas with respect to floating-point numbers
+ where `gawk' disagrees with the POSIX standard. It pays to be
+ aware of them.
* Overall, there is no need to be unduly suspicious about the
results from floating-point arithmetic. The lesson to remember is
that floating-point arithmetic is always more complex than
arithmetic using pencil and paper. In order to take advantage of
- the power of computer floating point, you need to know its
+ the power of floating-point arithmetic, you need to know its
limitations and work within them. For most casual use of
floating-point arithmetic, you will often get the expected result
if you simply round the display of your final results to the
@@ -22784,7 +22858,7 @@ the rest of this Info file.
`gawk''s functionality. For example, they can provide access to system
calls (such as `chdir()' to change directory) and to other C library
routines that could be of use. As with most software, "the sky is the
-limit;" if you can imagine something that you might want to do and can
+limit"; if you can imagine something that you might want to do and can
write in C or C++, you can write an extension to do it!
Extensions are written in C or C++, using the "application
@@ -22792,7 +22866,7 @@ programming interface" (API) defined for this purpose by the `gawk'
developers. The rest of this major node explains the facilities that
the API provides and how to use them, and presents a small example
extension. In addition, it documents the sample extensions included in
-the `gawk' distribution, and describes the `gawkextlib' project. *Note
+the `gawk' distribution and describes the `gawkextlib' project. *Note
Extension Design::, for a discussion of the extension mechanism goals
and design.
@@ -22910,7 +22984,7 @@ Example::) and also in the `testext.c' code for testing the APIs.
Some other bits and pieces:
* The API provides access to `gawk''s `do_XXX' values, reflecting
- command-line options, like `do_lint', `do_profiling' and so on
+ command-line options, like `do_lint', `do_profiling', and so on
(*note Extension API Variables::). These are informational: an
extension cannot affect their values inside `gawk'. In addition,
attempting to assign to them produces a compile-time error.
@@ -22957,8 +23031,8 @@ File: gawk.info, Node: Extension API Functions Introduction, Next: General Dat
16.4.1 Introduction
-------------------
-Access to facilities within `gawk' are made available by calling
-through function pointers passed into your extension.
+Access to facilities within `gawk' is achieved by calling through
+function pointers passed into your extension.
API function pointers are provided for the following kinds of
operations:
@@ -22979,7 +23053,7 @@ operations:
- Two-way processors
- All of these are discussed in detail, later in this major node.
+ All of these are discussed in detail later in this major node.
* Printing fatal, warning, and "lint" warning messages.
@@ -23005,7 +23079,7 @@ operations:
- Clearing an array
- - Flattening an array for easy C style looping over all its
+ - Flattening an array for easy C-style looping over all its
indices and elements
* Accessing and manipulating redirections.
@@ -23017,7 +23091,7 @@ operations:
`gawkapi.h'. For correct use, you must therefore include the
corresponding standard header file _before_ including `gawkapi.h':
- C Entity Header File
+ C entity Header file
-------------------------------------------
`EOF' `<stdio.h>'
Values for `errno' `<errno.h>'
@@ -23041,13 +23115,13 @@ operations:
* Although the API only uses ISO C 90 features, there is an
exception; the "constructor" functions use the `inline' keyword.
If your compiler does not support this keyword, you should either
- place `-Dinline=''' on your command line, or use the GNU Autotools
+ place `-Dinline=''' on your command line or use the GNU Autotools
and include a `config.h' file in your extensions.
* All pointers filled in by `gawk' point to memory managed by `gawk'
and should be treated by the extension as read-only. Memory for
_all_ strings passed into `gawk' from the extension _must_ come
- from calling one of `gawk_malloc()', `gawk_calloc()' or
+ from calling one of `gawk_malloc()', `gawk_calloc()', or
`gawk_realloc()', and is managed by `gawk' from then on.
* The API defines several simple `struct's that map values as seen
@@ -23060,7 +23134,7 @@ operations:
multibyte encoding (as defined by `LC_XXX' environment
variables) and not using wide characters. This matches how
`gawk' stores strings internally and also how characters are
- likely to be input and output from files.
+ likely to be input into and output from files.
* When retrieving a value (such as a parameter or that of a global
variable or array element), the extension requests a specific type
@@ -23097,6 +23171,8 @@ general-purpose use. Additional, more specialized, data structures are
introduced in subsequent minor nodes, together with the functions that
use them.
+ The general-purpose types and structures are as follows:
+
`typedef void *awk_ext_id_t;'
A value of this type is received from `gawk' when an extension is
loaded. That value must then be passed back to `gawk' as the
@@ -23112,7 +23188,7 @@ use them.
` awk_false = 0,'
` awk_true'
`} awk_bool_t;'
- A simple boolean type.
+ A simple Boolean type.
`typedef struct awk_string {'
` char *str; /* data */'
@@ -23156,8 +23232,8 @@ use them.
`#define array_cookie u.a'
`#define scalar_cookie u.scl'
`#define value_cookie u.vc'
- These macros make accessing the fields of the `awk_value_t' more
- readable.
+ Using these macros makes accessing the fields of the `awk_value_t'
+ more readable.
`typedef void *awk_scalar_t;'
Scalars can be represented as an opaque type. These values are
@@ -23177,8 +23253,8 @@ indicates what is in the `union'.
Representing numbers is easy--the API uses a C `double'. Strings
require more work. Because `gawk' allows embedded NUL bytes in string
-values, a string must be represented as a pair containing a
-data-pointer and length. This is the `awk_string_t' type.
+values, a string must be represented as a pair containing a data
+pointer and length. This is the `awk_string_t' type.
Identifiers (i.e., the names of global variables) can be associated
with either scalar values or with arrays. In addition, `gawk' provides
@@ -23190,12 +23266,12 @@ Manipulation::.
of the `union' as if they were fields in a `struct'; this is a common
coding practice in C. Such code is easier to write and to read, but it
remains _your_ responsibility to make sure that the `val_type' member
-correctly reflects the type of the value in the `awk_value_t'.
+correctly reflects the type of the value in the `awk_value_t' struct.
Conceptually, the first three members of the `union' (number, string,
and array) are all that is needed for working with `awk' values.
However, because the API provides routines for accessing and changing
-the value of global scalar variables only by using the variable's name,
+the value of a global scalar variable only by using the variable's name,
there is a performance penalty: `gawk' must find the variable each time
it is accessed and changed. This turns out to be a real issue, not
just a theoretical one.
@@ -23204,17 +23280,19 @@ just a theoretical one.
reading and/or changing the value of one or more scalar variables, you
can obtain a "scalar cookie"(1) object for that variable, and then use
the cookie for getting the variable's value or for changing the
-variable's value. This is the `awk_scalar_t' type and `scalar_cookie'
-macro. Given a scalar cookie, `gawk' can directly retrieve or modify
-the value, as required, without having to find it first.
+variable's value. The `awk_scalar_t' type holds a scalar cookie, and
+the `scalar_cookie' macro provides access to the value of that type in
+the `awk_value_t' struct. Given a scalar cookie, `gawk' can directly
+retrieve or modify the value, as required, without having to find it
+first.
The `awk_value_cookie_t' type and `value_cookie' macro are similar.
If you know that you wish to use the same numeric or string _value_ for
one or more variables, you can create the value once, retaining a
"value cookie" for it, and then pass in that value cookie whenever you
-wish to set the value of a variable. This saves both storage space
-within the running `gawk' process as well as the time needed to create
-the value.
+wish to set the value of a variable. This saves storage space within
+the running `gawk' process and reduces the time needed to create the
+value.
---------- Footnotes ----------
@@ -23249,7 +23327,7 @@ prototypes, in the way that extension code would use them:
`void gawk_free(void *ptr);'
Call the correct version of `free()' to release storage that was
- allocated with `gawk_malloc()', `gawk_calloc()' or
+ allocated with `gawk_malloc()', `gawk_calloc()', or
`gawk_realloc()'.
The API has to provide these functions because it is possible for an
@@ -23261,7 +23339,7 @@ version of `malloc()', unexpected behavior would likely result.
Two convenience macros may be used for allocating storage from
`gawk_malloc()' and `gawk_realloc()'. If the allocation fails, they
cause `gawk' to exit with a fatal error message. They should be used
-as if they were procedure calls that do not return a value.
+as if they were procedure calls that do not return a value:
`#define emalloc(pointer, type, size, message) ...'
The arguments to this macro are as follows:
@@ -23291,13 +23369,13 @@ as if they were procedure calls that do not return a value.
make_malloced_string(message, strlen(message), & result);
`#define erealloc(pointer, type, size, message) ...'
- This is like `emalloc()', but it calls `gawk_realloc()', instead
- of `gawk_malloc()'. The arguments are the same as for the
+ This is like `emalloc()', but it calls `gawk_realloc()' instead of
+ `gawk_malloc()'. The arguments are the same as for the
`emalloc()' macro.
---------- Footnotes ----------
- (1) This is more common on MS-Windows systems, but can happen on
+ (1) This is more common on MS-Windows systems, but it can happen on
Unix-like systems as well.

@@ -23312,29 +23390,29 @@ This node presents them all as function prototypes, in the way that
extension code would use them:
`static inline awk_value_t *'
-`make_const_string(const char *string, size_t length, awk_value_t *result)'
+`make_const_string(const char *string, size_t length, awk_value_t *result);'
This function creates a string value in the `awk_value_t' variable
pointed to by `result'. It expects `string' to be a C string
constant (or other string data), and automatically creates a
_copy_ of the data for storage in `result'. It returns `result'.
`static inline awk_value_t *'
-`make_malloced_string(const char *string, size_t length, awk_value_t *result)'
+`make_malloced_string(const char *string, size_t length, awk_value_t *result);'
This function creates a string value in the `awk_value_t' variable
pointed to by `result'. It expects `string' to be a `char *' value
pointing to data previously obtained from `gawk_malloc()',
- `gawk_calloc()' or `gawk_realloc()'. The idea here is that the
+ `gawk_calloc()', or `gawk_realloc()'. The idea here is that the
data is passed directly to `gawk', which assumes responsibility
for it. It returns `result'.
`static inline awk_value_t *'
-`make_null_string(awk_value_t *result)'
+`make_null_string(awk_value_t *result);'
This specialized function creates a null string (the "undefined"
value) in the `awk_value_t' variable pointed to by `result'. It
returns `result'.
`static inline awk_value_t *'
-`make_number(double num, awk_value_t *result)'
+`make_number(double num, awk_value_t *result);'
This function simply creates a numeric value in the `awk_value_t'
variable pointed to by `result'.
@@ -23373,7 +23451,7 @@ Extension functions are described by the following record:
The fields are:
`const char *name;'
- The name of the new function. `awk' level code calls the function
+ The name of the new function. `awk'-level code calls the function
by this name. This is a regular C string.
Function names must obey the rules for `awk' identifiers. That is,
@@ -23385,7 +23463,7 @@ Extension functions are described by the following record:
This is a pointer to the C function that provides the extension's
functionality. The function must fill in `*result' with either a
number or a string. `gawk' takes ownership of any string memory.
- As mentioned earlier, string memory *must* come from one of
+ As mentioned earlier, string memory _must_ come from one of
`gawk_malloc()', `gawk_calloc()', or `gawk_realloc()'.
The `num_actual_args' argument tells the C function how many
@@ -23432,10 +23510,10 @@ function with `gawk' using the following function:
`gawk' intends to pass to the `exit()' system call.
`arg0'
- A pointer to private data which `gawk' saves in order to pass
+ A pointer to private data that `gawk' saves in order to pass
to the function pointed to by `funcp'.
- Exit callback functions are called in last-in-first-out (LIFO)
+ Exit callback functions are called in last-in, first-out (LIFO)
order--that is, in the reverse order in which they are registered with
`gawk'.
@@ -23445,8 +23523,8 @@ File: gawk.info, Node: Extension Version String, Next: Input Parsers, Prev: E
16.4.5.3 Registering An Extension Version String
................................................
-You can register a version string which indicates the name and version
-of your extension, with `gawk', as follows:
+You can register a version string that indicates the name and version
+of your extension with `gawk', as follows:
`void register_ext_version(const char *version);'
Register the string pointed to by `version' with `gawk'. Note
@@ -23469,7 +23547,7 @@ Files::). Additionally, it sets the value of `RT' (*note Built-in
Variables::).
If you want, you can provide your own custom input parser. An input
-parser's job is to return a record to the `gawk' record processing
+parser's job is to return a record to the `gawk' record-processing
code, along with indicators for the value and length of the data to be
used for `RT', if any.
@@ -23486,10 +23564,10 @@ used for `RT', if any.
`awk_bool_t XXX_take_control_of(awk_input_buf_t *iobuf);'
When `gawk' decides to hand control of the file over to the input
parser, it calls this function. This function in turn must fill
- in certain fields in the `awk_input_buf_t' structure, and ensure
+ in certain fields in the `awk_input_buf_t' structure and ensure
that certain conditions are true. It should then return true. If
- an error of some kind occurs, it should not fill in any fields,
- and should return false; then `gawk' will not use the input parser.
+ an error of some kind occurs, it should not fill in any fields and
+ should return false; then `gawk' will not use the input parser.
The details are presented shortly.
Your extension should package these functions inside an
@@ -23566,10 +23644,10 @@ the `struct stat', or any combination of these factors.
Once `XXX_can_take_file()' has returned true, and `gawk' has decided
to use your input parser, it calls `XXX_take_control_of()'. That
-function then fills one of either the `get_record' field or the
-`read_func' field in the `awk_input_buf_t'. It must also ensure that
-`fd' is _not_ set to `INVALID_HANDLE'. The following list describes
-the fields that may be filled by `XXX_take_control_of()':
+function then fills either the `get_record' field or the `read_func'
+field in the `awk_input_buf_t'. It must also ensure that `fd' is _not_
+set to `INVALID_HANDLE'. The following list describes the fields that
+may be filled by `XXX_take_control_of()':
`void *opaque;'
This is used to hold any state information needed by the input
@@ -23586,22 +23664,22 @@ the fields that may be filled by `XXX_take_control_of()':
Its behavior is described in the text following this list.
`ssize_t (*read_func)();'
- This function pointer should point to function that has the same
+ This function pointer should point to a function that has the same
behavior as the standard POSIX `read()' system call. It is an
alternative to the `get_record' pointer. Its behavior is also
described in the text following this list.
`void (*close_func)(struct awk_input *iobuf);'
This function pointer should point to a function that does the
- "tear down." It should release any resources allocated by
+ "teardown." It should release any resources allocated by
`XXX_take_control_of()'. It may also close the file. If it does
so, it should set the `fd' field to `INVALID_HANDLE'.
If `fd' is still not `INVALID_HANDLE' after the call to this
function, `gawk' calls the regular `close()' system call.
- Having a "tear down" function is optional. If your input parser
- does not need it, do not set this field. Then, `gawk' calls the
+ Having a "teardown" function is optional. If your input parser does
+ not need it, do not set this field. Then, `gawk' calls the
regular `close()' system call on the file descriptor, so it should
be valid.
@@ -23609,7 +23687,7 @@ the fields that may be filled by `XXX_take_control_of()':
records. The parameters are as follows:
`char **out'
- This is a pointer to a `char *' variable which is set to point to
+ This is a pointer to a `char *' variable that is set to point to
the record. `gawk' makes its own copy of the data, so the
extension must manage this storage.
@@ -23658,16 +23736,16 @@ explicitly.
NOTE: You must choose one method or the other: either a function
that returns a record, or one that returns raw data. In
particular, if you supply a function to get a record, `gawk' will
- call it, and never call the raw read function.
+ call it, and will never call the raw read function.
`gawk' ships with a sample extension that reads directories,
-returning records for each entry in the directory (*note Extension
-Sample Readdir::). You may wish to use that code as a guide for writing
-your own input parser.
+returning records for each entry in a directory (*note Extension Sample
+Readdir::). You may wish to use that code as a guide for writing your
+own input parser.
When writing an input parser, you should think about (and document)
how it is expected to interact with `awk' code. You may want it to
-always be called, and take effect as appropriate (as the `readdir'
+always be called, and to take effect as appropriate (as the `readdir'
extension does). Or you may want it to take effect based upon the
value of an `awk' variable, as the XML extension from the `gawkextlib'
project does (*note gawkextlib::). In the latter case, code in a
@@ -23767,17 +23845,17 @@ in the `awk_output_buf_t'. The data members are as follows:
These pointers should be set to point to functions that perform
the equivalent function as the `<stdio.h>' functions do, if
appropriate. `gawk' uses these function pointers for all output.
- `gawk' initializes the pointers to point to internal, "pass
- through" functions that just call the regular `<stdio.h>'
- functions, so an extension only needs to redefine those functions
- that are appropriate for what it does.
+ `gawk' initializes the pointers to point to internal "pass-through"
+ functions that just call the regular `<stdio.h>' functions, so an
+ extension only needs to redefine those functions that are
+ appropriate for what it does.
The `XXX_can_take_file()' function should make a decision based upon
the `name' and `mode' fields, and any additional state (such as `awk'
variable values) that is appropriate.
When `gawk' calls `XXX_take_control_of()', that function should fill
-in the other fields, as appropriate, except for `fp', which it should
+in the other fields as appropriate, except for `fp', which it should
just use normally.
You register your output wrapper with the following function:
@@ -23814,16 +23892,17 @@ structures as described earlier.
The name of the two-way processor.
`awk_bool_t (*can_take_two_way)(const char *name);'
- This function returns true if it wants to take over two-way I/O
- for this file name. It should not change any state (variable
- values, etc.) within `gawk'.
+ The function pointed to by this field should return true if it
+ wants to take over two-way I/O for this file name. It should not
+ change any state (variable values, etc.) within `gawk'.
`awk_bool_t (*take_control_of)(const char *name,'
` awk_input_buf_t *inbuf,'
` awk_output_buf_t *outbuf);'
- This function should fill in the `awk_input_buf_t' and
- `awk_outut_buf_t' structures pointed to by `inbuf' and `outbuf',
- respectively. These structures were described earlier.
+ The function pointed to by this field should fill in the
+ `awk_input_buf_t' and `awk_outut_buf_t' structures pointed to by
+ `inbuf' and `outbuf', respectively. These structures were
+ described earlier.
`awk_const struct two_way_processor *awk_const next;'
This is for use by `gawk'; therefore it is marked `awk_const' so
@@ -23847,7 +23926,7 @@ File: gawk.info, Node: Printing Messages, Next: Updating `ERRNO', Prev: Regis
You can print different kinds of warning messages from your extension,
as described here. Note that for these functions, you must pass in the
-extension id received from `gawk' when the extension was loaded:(1)
+extension ID received from `gawk' when the extension was loaded:(1)
`void fatal(awk_ext_id_t id, const char *format, ...);'
Print a message and then cause `gawk' to exit immediately.
@@ -23903,7 +23982,7 @@ value you expect. If the actual value matches what you requested, the
function returns true and fills in the `awk_value_t' result.
Otherwise, the function returns false, and the `val_type' member
indicates the type of the actual value. You may then print an error
-message, or reissue the request for the actual value type, as
+message or reissue the request for the actual value type, as
appropriate. This behavior is summarized in *note
table-value-types-returned::.
@@ -23912,15 +23991,15 @@ table-value-types-returned::.
String Number Array Undefined
------------------------------------------------------------------------------
- String String String false false
- Number Number if can Number false false
+ String String String False False
+ Number Number if can Number False False
be converted,
else false
-Type Array false false Array false
-Requested Scalar Scalar Scalar false false
+Type Array False False Array False
+Requested Scalar Scalar Scalar False False
Undefined String Number Array Undefined
- Value false false false false
- Cookie
+ Value False False False False
+ cookie
Table 16.1: API value types returned
@@ -23937,16 +24016,16 @@ your extension function. They are:
` awk_valtype_t wanted,'
` awk_value_t *result);'
Fill in the `awk_value_t' structure pointed to by `result' with
- the `count''th argument. Return true if the actual type matches
- `wanted', false otherwise. In the latter case, `result->val_type'
- indicates the actual type (*note Table 16.1:
- table-value-types-returned.). Counts are zero based--the first
+ the `count'th argument. Return true if the actual type matches
+ `wanted', and false otherwise. In the latter case,
+ `result->val_type' indicates the actual type (*note Table 16.1:
+ table-value-types-returned.). Counts are zero-based--the first
argument is numbered zero, the second one, and so on. `wanted'
indicates the type of value expected.
`awk_bool_t set_argument(size_t count, awk_array_t array);'
Convert a parameter that was undefined into an array; this provides
- call-by-reference for arrays. Return false if `count' is too big,
+ call by reference for arrays. Return false if `count' is too big,
or if the argument's type is not undefined. *Note Array
Manipulation::, for more information on creating arrays.
@@ -23974,8 +24053,8 @@ File: gawk.info, Node: Symbol table by name, Next: Symbol table by cookie, Up
The following routines provide the ability to access and update global
`awk'-level variables by name. In compiler terminology, identifiers of
different kinds are termed "symbols", thus the "sym" in the routines'
-names. The data structure which stores information about symbols is
-termed a "symbol table".
+names. The data structure that stores information about symbols is
+termed a "symbol table". The functions are as follows:
`awk_bool_t sym_lookup(const char *name,'
` awk_valtype_t wanted,'
@@ -23983,14 +24062,14 @@ termed a "symbol table".
Fill in the `awk_value_t' structure pointed to by `result' with
the value of the variable named by the string `name', which is a
regular C string. `wanted' indicates the type of value expected.
- Return true if the actual type matches `wanted', false otherwise.
- In the latter case, `result->val_type' indicates the actual type
- (*note Table 16.1: table-value-types-returned.).
+ Return true if the actual type matches `wanted', and false
+ otherwise. In the latter case, `result->val_type' indicates the
+ actual type (*note Table 16.1: table-value-types-returned.).
`awk_bool_t sym_update(const char *name, awk_value_t *value);'
Update the variable named by the string `name', which is a regular
C string. The variable is added to `gawk''s symbol table if it is
- not there. Return true if everything worked, false otherwise.
+ not there. Return true if everything worked, and false otherwise.
Changing types (scalar to array or vice versa) of an existing
variable is _not_ allowed, nor may this routine be used to update
@@ -24015,7 +24094,7 @@ File: gawk.info, Node: Symbol table by cookie, Next: Cached values, Prev: Sym
A "scalar cookie" is an opaque handle that provides access to a global
variable or array. It is an optimization that avoids looking up
variables in `gawk''s symbol table every time access is needed. This
-was discussed earlier in *note General Data Types::.
+was discussed earlier, in *note General Data Types::.
The following functions let you work with scalar cookies:
@@ -24126,7 +24205,7 @@ File: gawk.info, Node: Cached values, Prev: Symbol table by cookie, Up: Symbo
..........................................
The routines in this section allow you to create and release cached
-values. As with scalar cookies, in theory, cached values are not
+values. Like scalar cookies, in theory, cached values are not
necessary. You can create numbers and strings using the functions in
*note Constructor Functions::. You can then assign those values to
variables using `sym_update()' or `sym_update_scalar()', as you like.
@@ -24197,7 +24276,7 @@ Using value cookies in this way saves considerable storage, as all of
`VAR1' through `VAR100' share the same value.
You might be wondering, "Is this sharing problematic? What happens
-if `awk' code assigns a new value to `VAR1', are all the others changed
+if `awk' code assigns a new value to `VAR1'; are all the others changed
too?"
That's a great question. The answer is that no, it's not a problem.
@@ -24316,7 +24395,7 @@ File: gawk.info, Node: Array Functions, Next: Flattening Arrays, Prev: Array
16.4.11.2 Array Functions
.........................
-The following functions relate to individual array elements.
+The following functions relate to individual array elements:
`awk_bool_t get_element_count(awk_array_t a_cookie, size_t *count);'
For the array represented by `a_cookie', place in `*count' the
@@ -24334,13 +24413,14 @@ The following functions relate to individual array elements.
(*note Table 16.1: table-value-types-returned.).
The value for `index' can be numeric, in which case `gawk'
- converts it to a string. Using non-integral values is possible, but
+ converts it to a string. Using nonintegral values is possible, but
requires that you understand how such values are converted to
- strings (*note Conversion::); thus using integral values is safest.
+ strings (*note Conversion::); thus, using integral values is
+ safest.
As with _all_ strings passed into `gawk' from an extension, the
string value of `index' must come from `gawk_malloc()',
- `gawk_calloc()' or `gawk_realloc()', and `gawk' releases the
+ `gawk_calloc()', or `gawk_realloc()', and `gawk' releases the
storage.
`awk_bool_t set_array_element(awk_array_t a_cookie,'
@@ -24384,9 +24464,9 @@ The following functions relate to individual array elements.
`awk_bool_t release_flattened_array(awk_array_t a_cookie,'
` awk_flat_array_t *data);'
When done with a flattened array, release the storage using this
- function. You must pass in both the original array cookie, and
- the address of the created `awk_flat_array_t' structure. The
- function returns true upon success, false otherwise.
+ function. You must pass in both the original array cookie and the
+ address of the created `awk_flat_array_t' structure. The function
+ returns true upon success, false otherwise.

File: gawk.info, Node: Flattening Arrays, Next: Creating Arrays, Prev: Array Functions, Up: Array Manipulation
@@ -24396,8 +24476,8 @@ File: gawk.info, Node: Flattening Arrays, Next: Creating Arrays, Prev: Array
To "flatten" an array is to create a structure that represents the full
array in a fashion that makes it easy for C code to traverse the entire
-array. Test code in `extension/testext.c' does this, and also serves
-as a nice example showing how to use the APIs.
+array. Some of the code in `extension/testext.c' does this, and also
+serves as a nice example showing how to use the APIs.
We walk through that part of the code one step at a time. First,
the `gawk' script that drives the test extension:
@@ -24446,9 +24526,8 @@ number of arguments:
}
The function then proceeds in steps, as follows. First, retrieve the
-name of the array, passed as the first argument. Then retrieve the
-array itself. If either operation fails, print error messages and
-return:
+name of the array, passed as the first argument, followed by the array
+itself. If either operation fails, print an error message and return:
/* get argument named array as flat array and print it */
if (get_argument(0, AWK_STRING, & value)) {
@@ -24478,9 +24557,9 @@ count of elements in the array and print it:
printf("dump_array_and_delete: incoming size is %lu\n",
(unsigned long) count);
- The third step is to actually flatten the array, and then to double
-check that the count in the `awk_flat_array_t' is the same as the count
-just retrieved:
+ The third step is to actually flatten the array, and then to
+double-check that the count in the `awk_flat_array_t' is the same as
+the count just retrieved:
if (! flatten_array(value2.array_cookie, & flat_array)) {
printf("dump_array_and_delete: could not flatten array\n");
@@ -24497,7 +24576,7 @@ just retrieved:
The fourth step is to retrieve the index of the element to be
deleted, which was passed as the second argument. Remember that
-argument counts passed to `get_argument()' are zero-based, thus the
+argument counts passed to `get_argument()' are zero-based, and thus the
second argument is numbered one:
if (! get_argument(1, AWK_STRING, & value3)) {
@@ -24510,7 +24589,7 @@ over every element in the array, printing the index and element values.
In addition, upon finding the element with the index that is supposed
to be deleted, the function sets the `AWK_ELEMENT_DELETE' bit in the
`flags' field of the element. When the array is released, `gawk'
-traverses the flattened array, and deletes any elements which have this
+traverses the flattened array, and deletes any elements that have this
flag bit set:
for (i = 0; i < flat_array->count; i++) {
@@ -24791,10 +24870,10 @@ The API provides both a "major" and a "minor" version number. The API
versions are available at compile time as constants:
`GAWK_API_MAJOR_VERSION'
- The major version of the API.
+ The major version of the API
`GAWK_API_MINOR_VERSION'
- The minor version of the API.
+ The minor version of the API
The minor version increases when new functions are added to the API.
Such new functions are always added to the end of the API `struct'.
@@ -24809,13 +24888,13 @@ For this reason, the major and minor API versions of the running `gawk'
are included in the API `struct' as read-only constant integers:
`api->major_version'
- The major version of the running `gawk'.
+ The major version of the running `gawk'
`api->minor_version'
- The minor version of the running `gawk'.
+ The minor version of the running `gawk'
It is up to the extension to decide if there are API
-incompatibilities. Typically a check like this is enough:
+incompatibilities. Typically, a check like this is enough:
if (api->major_version != GAWK_API_MAJOR_VERSION
|| api->minor_version < GAWK_API_MINOR_VERSION) {
@@ -24827,7 +24906,7 @@ incompatibilities. Typically a check like this is enough:
}
Such code is included in the boilerplate `dl_load_func()' macro
-provided in `gawkapi.h' (discussed later, in *note Extension API
+provided in `gawkapi.h' (discussed in *note Extension API
Boilerplate::).

@@ -24878,7 +24957,7 @@ functions) toward the top of your source file, using predefined names
as described here. The boilerplate needed is also provided in comments
in the `gawkapi.h' header file:
- /* Boiler plate code: */
+ /* Boilerplate code: */
int plugin_is_GPL_compatible;
static gawk_api_t *const api;
@@ -24928,7 +25007,7 @@ in the `gawkapi.h' header file:
to point to a string giving the name and version of your extension.
`static awk_ext_func_t func_table[] = { ... };'
- This is an array of one or more `awk_ext_func_t' structures as
+ This is an array of one or more `awk_ext_func_t' structures, as
described earlier (*note Extension Functions::). It can then be
looped over for multiple calls to `add_ext_func()'.
@@ -25041,7 +25120,7 @@ appropriate information:
`stat()' fails. It fills in the following elements:
`"name"'
- The name of the file that was `stat()''ed.
+ The name of the file that was `stat()'ed.
`"dev"'
`"ino"'
@@ -25089,7 +25168,7 @@ appropriate information:
The file is a directory.
`"fifo"'
- The file is a named-pipe (also known as a FIFO).
+ The file is a named pipe (also known as a FIFO).
`"file"'
The file is just a regular file.
@@ -25109,7 +25188,7 @@ appropriate information:
systems, "a priori" knowledge is used to provide a value. Where no
value can be determined, it defaults to 512.
- Several additional elements may be present depending upon the
+ Several additional elements may be present, depending upon the
operating system and the type of the file. You can test for them in
your `awk' program by using the `in' operator (*note Reference to
Elements::):
@@ -25138,9 +25217,9 @@ File: gawk.info, Node: Internal File Ops, Next: Using Internal File Ops, Prev
Here is the C code for these extensions.(1)
The file includes a number of standard header files, and then
-includes the `gawkapi.h' header file which provides the API definitions.
-Those are followed by the necessary variable declarations to make use
-of the API macros and boilerplate code (*note Extension API
+includes the `gawkapi.h' header file, which provides the API
+definitions. Those are followed by the necessary variable declarations
+to make use of the API macros and boilerplate code (*note Extension API
Boilerplate::):
#ifdef HAVE_CONFIG_H
@@ -25176,9 +25255,9 @@ Boilerplate::):
By convention, for an `awk' function `foo()', the C function that
implements it is called `do_foo()'. The function should have two
-arguments: the first is an `int' usually called `nargs', that
+arguments. The first is an `int', usually called `nargs', that
represents the number of actual arguments for the function. The second
-is a pointer to an `awk_value_t', usually named `result':
+is a pointer to an `awk_value_t' structure, usually named `result':
/* do_chdir --- provide dynamically loaded chdir() function for gawk */
@@ -25214,8 +25293,8 @@ is numbered zero.
}
The `stat()' extension is more involved. First comes a function
-that turns a numeric mode into a printable representation (e.g., 644
-becomes `-rw-r--r--'). This is omitted here for brevity:
+that turns a numeric mode into a printable representation (e.g., octal
+`0644' becomes `-rw-r--r--'). This is omitted here for brevity:
/* format_mode --- turn a stat mode field into something readable */
@@ -25265,8 +25344,8 @@ contain the result of the `stat()':
The following function does most of the work to fill in the
`awk_array_t' result array with values obtained from a valid `struct
-stat'. It is done in a separate function to support the `stat()'
-function for `gawk' and also to support the `fts()' extension which is
+stat'. This work is done in a separate function to support the `stat()'
+function for `gawk' and also to support the `fts()' extension, which is
included in the same file but whose code is not shown here (*note
Extension Sample File Functions::).
@@ -25378,8 +25457,8 @@ argument is optional. If present, it causes `do_stat()' to use the
`stat()' system call instead of the `lstat()' system call. This is
done by using a function pointer: `statfunc'. `statfunc' is
initialized to point to `lstat()' (instead of `stat()') to get the file
-information, in case the file is a symbolic link. However, if there
-were three arguments, `statfunc' is set point to `stat()', instead.
+information, in case the file is a symbolic link. However, if the third
+argument is included, `statfunc' is set to point to `stat()', instead.
Here is the `do_stat()' function, which starts with variable
declarations and argument checking:
@@ -25428,7 +25507,7 @@ returns:
/* always empty out the array */
clear_array(array);
- /* stat the file, if error, set ERRNO and return */
+ /* stat the file; if error, set ERRNO and return */
ret = statfunc(name, & sbuf);
if (ret < 0) {
update_ERRNO_int(errno);
@@ -25447,7 +25526,8 @@ When done, the function returns the result from `fill_stat_array()':
function(s) into `gawk'.
The `filefuncs' extension also provides an `fts()' function, which
-we omit here. For its sake there is an initialization function:
+we omit here (*note Extension Sample File Functions::). For its sake,
+there is an initialization function:
/* init_filefuncs --- initialization routine */
@@ -25571,9 +25651,9 @@ File: gawk.info, Node: Extension Samples, Next: gawkextlib, Prev: Extension E
16.7 The Sample Extensions in the `gawk' Distribution
=====================================================
-This minor node provides brief overviews of the sample extensions that
+This minor node provides a brief overview of the sample extensions that
come in the `gawk' distribution. Some of them are intended for
-production use (e.g., the `filefuncs', `readdir' and `inplace'
+production use (e.g., the `filefuncs', `readdir', and `inplace'
extensions). Others mainly provide example code that shows how to use
the extension API.
@@ -25610,13 +25690,13 @@ follows. The usage is:
`result = chdir("/some/directory")'
The `chdir()' function is a direct hook to the `chdir()' system
call to change the current directory. It returns zero upon
- success or less than zero upon error. In the latter case, it
- updates `ERRNO'.
+ success or a value less than zero upon error. In the latter case,
+ it updates `ERRNO'.
`result = stat("/some/path", statdata' [`, follow']`)'
The `stat()' function provides a hook into the `stat()' system
- call. It returns zero upon success or less than zero upon error.
- In the latter case, it updates `ERRNO'.
+ call. It returns zero upon success or a value less than zero upon
+ error. In the latter case, it updates `ERRNO'.
By default, it uses the `lstat()' system call. However, if passed
a third argument, it uses `stat()' instead.
@@ -25643,23 +25723,23 @@ follows. The usage is:
`"minor"' `st_minor' Device files
`"blksize"'`st_blksize' All
`"pmode"' A human-readable version of the All
- mode value, such as printed by
- `ls'. For example,
- `"-rwxr-xr-x"'
+ mode value, like that printed by
+ `ls' (for example,
+ `"-rwxr-xr-x"')
`"linkval"'The value of the symbolic link Symbolic
links
- `"type"' The type of the file as a string. All
- One of `"file"', `"blockdev"',
- `"chardev"', `"directory"',
- `"socket"', `"fifo"', `"symlink"',
- `"door"', or `"unknown"'. Not
- all systems support all file
- types.
+ `"type"' The type of the file as a All
+ string--one of `"file"',
+ `"blockdev"', `"chardev"',
+ `"directory"', `"socket"',
+ `"fifo"', `"symlink"', `"door"',
+ or `"unknown"' (not all systems
+ support all file types)
`flags = or(FTS_PHYSICAL, ...)'
`result = fts(pathlist, flags, filedata)'
Walk the file trees provided in `pathlist' and fill in the
- `filedata' array as described next. `flags' is the bitwise OR of
+ `filedata' array, as described next. `flags' is the bitwise OR of
several predefined values, also described in a moment. Return
zero if there were no errors, otherwise return -1.
@@ -25712,10 +25792,11 @@ requested hierarchies.
filesystem.
`filedata'
- The `filedata' array is first cleared. Then, `fts()' creates an
- element in `filedata' for every element in `pathlist'. The index
- is the name of the directory or file given in `pathlist'. The
- element for this index is itself an array. There are two cases:
+ The `filedata' array holds the results. `fts()' first clears it.
+ Then it creates an element in `filedata' for every element in
+ `pathlist'. The index is the name of the directory or file given
+ in `pathlist'. The element for this index is itself an array.
+ There are two cases:
_The path is a file_
In this case, the array contains two or three elements:
@@ -25751,7 +25832,7 @@ requested hierarchies.
elements as for a file: `"path"', `"stat"', and `"error"'.
The `fts()' function returns zero if there were no errors.
-Otherwise it returns -1.
+Otherwise, it returns -1.
NOTE: The `fts()' extension does not exactly mimic the interface
of the C library `fts()' routines, choosing instead to provide an
@@ -25790,14 +25871,14 @@ adds one constant (`FNM_NOMATCH'), and an array of flag values named
The arguments to `fnmatch()' are:
`pattern'
- The file name wildcard to match.
+ The file name wildcard to match
`string'
- The file name string.
+ The file name string
`flag'
Either zero, or the bitwise OR of one or more of the flags in the
- `FNM' array.
+ `FNM' array
The flags are as follows:
@@ -25831,13 +25912,13 @@ The `fork' extension adds three functions, as follows:
`pid = fork()'
This function creates a new process. The return value is zero in
- the child and the process-ID number of the child in the parent, or
+ the child and the process ID number of the child in the parent, or
-1 upon error. In the latter case, `ERRNO' indicates the problem.
In the child, `PROCINFO["pid"]' and `PROCINFO["ppid"]' are updated
to reflect the correct values.
`ret = waitpid(pid)'
- This function takes a numeric argument, which is the process-ID to
+ This function takes a numeric argument, which is the process ID to
wait for. The return value is that of the `waitpid()' system call.
`ret = wait()'
@@ -25861,8 +25942,8 @@ File: gawk.info, Node: Extension Sample Inplace, Next: Extension Sample Ord,
16.7.4 Enabling In-Place File Editing
-------------------------------------
-The `inplace' extension emulates GNU `sed''s `-i' option which performs
-"in place" editing of each input file. It uses the bundled
+The `inplace' extension emulates GNU `sed''s `-i' option, which
+performs "in-place" editing of each input file. It uses the bundled
`inplace.awk' include file to invoke the extension properly:
# inplace --- load and invoke the inplace extension.
@@ -25872,11 +25953,16 @@ The `inplace' extension emulates GNU `sed''s `-i' option which performs
# Please set INPLACE_SUFFIX to make a backup copy. For example, you may
# want to set INPLACE_SUFFIX to .bak on the command line or in a BEGIN rule.
+ # N.B. We call inplace_end() in the BEGINFILE and END rules so that any
+ # actions in an ENDFILE rule will be redirected as expected.
+
BEGINFILE {
- inplace_begin(FILENAME, INPLACE_SUFFIX)
+ if (_inplace_filename != "")
+ inplace_end(_inplace_filename, INPLACE_SUFFIX)
+ inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX)
}
- ENDFILE {
+ END {
inplace_end(FILENAME, INPLACE_SUFFIX)
}
@@ -25888,6 +25974,10 @@ the extension restores standard output to its original destination. If
a backup file name created by appending that suffix. Finally, the
temporary file is renamed to the original file name.
+ The `_inplace_filename' variable serves to keep track of the current
+filename so as to not invoke `inplace_end()' before processing the
+first file.
+
If any error occurs, the extension issues a fatal error to terminate
processing immediately without damaging the original file.
@@ -25945,11 +26035,11 @@ returned as a record.
The record consists of three fields. The first two are the inode
number and the file name, separated by a forward slash character. On
systems where the directory entry contains the file type, the record
-has a third field (also separated by a slash) which is a single letter
+has a third field (also separated by a slash), which is a single letter
indicating the type of the file. The letters and their corresponding
file types are shown in *note table-readdir-file-types::.
-Letter File Type
+Letter File type
--------------------------------------------------------------------------
`b' Block device
`c' Character device
@@ -25996,7 +26086,7 @@ unwary. Here is an example:
print "don't panic" > "/dev/stdout"
}
- The output from this program is: `cinap t'nod'.
+ The output from this program is `cinap t'nod'.

File: gawk.info, Node: Extension Sample Rev2way, Next: Extension Sample Read write array, Prev: Extension Sample Revout, Up: Extension Samples
@@ -26044,7 +26134,7 @@ The `rwarray' extension adds two functions, named `writea()' and
`reada()' is the inverse of `writea()'; it reads the file named as
its first argument, filling in the array named as the second
argument. It clears the array first. Here too, the return value
- is one on success and zero upon failure.
+ is one on success, or zero upon failure.
The array created by `reada()' is identical to that written by
`writea()' in the sense that the contents are the same. However, due to
@@ -26128,7 +26218,7 @@ The `time' extension adds two functions, named `gettimeofday()' and
Attempt to sleep for SECONDS seconds. If SECONDS is negative, or
the attempt to sleep fails, return -1 and set `ERRNO'. Otherwise,
return zero after sleeping for the indicated amount of time. Note
- that SECONDS may be a floating-point (non-integral) value.
+ that SECONDS may be a floating-point (nonintegral) value.
Implementation details: depending on platform availability, this
function tries to use `nanosleep()' or `select()' to implement the
delay.
@@ -26156,7 +26246,9 @@ provides a number of `gawk' extensions, including one for processing
XML files. This is the evolution of the original `xgawk' (XML `gawk')
project.
- As of this writing, there are six extensions:
+ As of this writing, there are seven extensions:
+
+ * `errno' extension
* GD graphics library extension
@@ -26165,7 +26257,7 @@ project.
* PostgreSQL extension
* MPFR library extension (this provides access to a number of MPFR
- functions which `gawk''s native MPFR support does not)
+ functions that `gawk''s native MPFR support does not)
* Redis extension
@@ -26206,7 +26298,7 @@ follows. First, build and install `gawk':
If you have installed `gawk' in the standard way, then you will
likely not need the `--with-gawk' option when configuring `gawkextlib'.
-You may also need to use the `sudo' utility to install both `gawk' and
+You may need to use the `sudo' utility to install both `gawk' and
`gawkextlib', depending upon how your system works.
If you write an extension that you wish to share with other `gawk'
@@ -26228,7 +26320,7 @@ File: gawk.info, Node: Extension summary, Next: Extension Exercises, Prev: ga
a variable named `plugin_is_GPL_compatible'.
* Communication between `gawk' and an extension is two-way. `gawk'
- passes a `struct' to the extension which contains various data
+ passes a `struct' to the extension that contains various data
fields and function pointers. The extension can then call into
`gawk' via the supplied function pointers to accomplish certain
tasks.
@@ -26239,7 +26331,7 @@ File: gawk.info, Node: Extension summary, Next: Extension Exercises, Prev: ga
convention, implementation functions are named `do_XXXX()' for
some `awk'-level function `XXXX()'.
- * The API is defined in a header file named `gawkpi.h'. You must
+ * The API is defined in a header file named `gawkapi.h'. You must
include a number of standard header files _before_ including it in
your source file.
@@ -26269,16 +26361,16 @@ File: gawk.info, Node: Extension summary, Next: Extension Exercises, Prev: ga
* Manipulating arrays (retrieving, adding, deleting, and
modifying elements; getting the count of elements in an array;
creating a new array; clearing an array; and flattening an
- array for easy C style looping over all its indices and
+ array for easy C-style looping over all its indices and
elements)
* The API defines a number of standard data types for representing
`awk' values, array elements, and arrays.
- * The API provide convenience functions for constructing values. It
- also provides memory management functions to ensure compatibility
- between memory allocated by `gawk' and memory allocated by an
- extension.
+ * The API provides convenience functions for constructing values.
+ It also provides memory management functions to ensure
+ compatibility between memory allocated by `gawk' and memory
+ allocated by an extension.
* _All_ memory passed from `gawk' to an extension must be treated as
read-only by the extension.
@@ -26296,8 +26388,8 @@ File: gawk.info, Node: Extension summary, Next: Extension Exercises, Prev: ga
header file make this easier to do.
* The `gawk' distribution includes a number of small but useful
- sample extensions. The `gawkextlib' project includes several more,
- larger, extensions. If you wish to write an extension and
+ sample extensions. The `gawkextlib' project includes several more
+ (larger) extensions. If you wish to write an extension and
contribute it to the community of `gawk' users, the `gawkextlib'
project is the place to do so.
@@ -26367,56 +26459,56 @@ available in System V Release 3.1 (1987). This minor node summarizes
the changes, with cross-references to further details:
* The requirement for `;' to separate rules on a line (*note
- Statements/Lines::).
+ Statements/Lines::)
* User-defined functions and the `return' statement (*note
- User-defined::).
+ User-defined::)
* The `delete' statement (*note Delete::).
- * The `do'-`while' statement (*note Do Statement::).
+ * The `do'-`while' statement (*note Do Statement::)
* The built-in functions `atan2()', `cos()', `sin()', `rand()', and
- `srand()' (*note Numeric Functions::).
+ `srand()' (*note Numeric Functions::)
* The built-in functions `gsub()', `sub()', and `match()' (*note
- String Functions::).
+ String Functions::)
* The built-in functions `close()' and `system()' (*note I/O
- Functions::).
+ Functions::)
* The `ARGC', `ARGV', `FNR', `RLENGTH', `RSTART', and `SUBSEP'
- predefined variables (*note Built-in Variables::).
+ predefined variables (*note Built-in Variables::)
- * Assignable `$0' (*note Changing Fields::).
+ * Assignable `$0' (*note Changing Fields::)
* The conditional expression using the ternary operator `?:' (*note
- Conditional Exp::).
+ Conditional Exp::)
- * The expression `INDEX-VARIABLE in ARRAY' outside of `for'
- statements (*note Reference to Elements::).
+ * The expression `INDX in ARRAY' outside of `for' statements (*note
+ Reference to Elements::)
* The exponentiation operator `^' (*note Arithmetic Ops::) and its
- assignment operator form `^=' (*note Assignment Ops::).
+ assignment operator form `^=' (*note Assignment Ops::)
* C-compatible operator precedence, which breaks some old `awk'
- programs (*note Precedence::).
+ programs (*note Precedence::)
* Regexps as the value of `FS' (*note Field Separators::) and as the
third argument to the `split()' function (*note String
- Functions::), rather than using only the first character of `FS'.
+ Functions::), rather than using only the first character of `FS'
* Dynamic regexps as operands of the `~' and `!~' operators (*note
- Computed Regexps::).
+ Computed Regexps::)
* The escape sequences `\b', `\f', and `\r' (*note Escape
- Sequences::).
+ Sequences::)
- * Redirection of input for the `getline' function (*note Getline::).
+ * Redirection of input for the `getline' function (*note Getline::)
- * Multiple `BEGIN' and `END' rules (*note BEGIN/END::).
+ * Multiple `BEGIN' and `END' rules (*note BEGIN/END::)
- * Multidimensional arrays (*note Multidimensional::).
+ * Multidimensional arrays (*note Multidimensional::)

File: gawk.info, Node: SVR4, Next: POSIX, Prev: V7/SVR3.1, Up: Language History
@@ -26427,37 +26519,37 @@ A.2 Changes Between SVR3.1 and SVR4
The System V Release 4 (1989) version of Unix `awk' added these features
(some of which originated in `gawk'):
- * The `ENVIRON' array (*note Built-in Variables::).
+ * The `ENVIRON' array (*note Built-in Variables::)
- * Multiple `-f' options on the command line (*note Options::).
+ * Multiple `-f' options on the command line (*note Options::)
* The `-v' option for assigning variables before program execution
- begins (*note Options::).
+ begins (*note Options::)
- * The `--' signal for terminating command-line options.
+ * The `--' signal for terminating command-line options
* The `\a', `\v', and `\x' escape sequences (*note Escape
- Sequences::).
+ Sequences::)
* A defined return value for the `srand()' built-in function (*note
- Numeric Functions::).
+ Numeric Functions::)
* The `toupper()' and `tolower()' built-in string functions for case
- translation (*note String Functions::).
+ translation (*note String Functions::)
* A cleaner specification for the `%c' format-control letter in the
- `printf' function (*note Control Letters::).
+ `printf' function (*note Control Letters::)
* The ability to dynamically pass the field width and precision
(`"%*.*d"') in the argument list of `printf' and `sprintf()'
- (*note Control Letters::).
+ (*note Control Letters::)
* The use of regexp constants, such as `/foo/', as expressions, where
they are equivalent to using the matching operator, as in `$0 ~
- /foo/' (*note Using Constant Regexps::).
+ /foo/' (*note Using Constant Regexps::)
* Processing of escape sequences inside command-line variable
- assignments (*note Assignment Options::).
+ assignments (*note Assignment Options::)

File: gawk.info, Node: POSIX, Next: BTL, Prev: SVR4, Up: Language History
@@ -26469,30 +26561,30 @@ The POSIX Command Language and Utilities standard for `awk' (1992)
introduced the following changes into the language:
* The use of `-W' for implementation-specific options (*note
- Options::).
+ Options::)
* The use of `CONVFMT' for controlling the conversion of numbers to
- strings (*note Conversion::).
+ strings (*note Conversion::)
* The concept of a numeric string and tighter comparison rules to go
- with it (*note Typing and Comparison::).
+ with it (*note Typing and Comparison::)
* The use of predefined variables as function parameter names is
- forbidden (*note Definition Syntax::).
+ forbidden (*note Definition Syntax::)
* More complete documentation of many of the previously undocumented
- features of the language.
+ features of the language
In 2012, a number of extensions that had been commonly available for
many years were finally added to POSIX. They are:
* The `fflush()' built-in function for flushing buffered output
- (*note I/O Functions::).
+ (*note I/O Functions::)
- * The `nextfile' statement (*note Nextfile Statement::).
+ * The `nextfile' statement (*note Nextfile Statement::)
* The ability to delete all of an array at once with `delete ARRAY'
- (*note Delete::).
+ (*note Delete::)
*Note Common Extensions::, for a list of common extensions not
@@ -26514,13 +26606,13 @@ Other Versions::).
in his version of `awk':
* The `**' and `**=' operators (*note Arithmetic Ops:: and *note
- Assignment Ops::).
+ Assignment Ops::)
* The use of `func' as an abbreviation for `function' (*note
- Definition Syntax::).
+ Definition Syntax::)
* The `fflush()' built-in function for flushing buffered output
- (*note I/O Functions::).
+ (*note I/O Functions::)
*Note Common Extensions::, for a full list of the extensions
@@ -26542,104 +26634,108 @@ the current version of `gawk'.
* Additional predefined variables:
- - The `ARGIND' `BINMODE', `ERRNO', `FIELDWIDTHS', `FPAT',
+ - The `ARGIND', `BINMODE', `ERRNO', `FIELDWIDTHS', `FPAT',
`IGNORECASE', `LINT', `PROCINFO', `RT', and `TEXTDOMAIN'
- variables (*note Built-in Variables::).
+ variables (*note Built-in Variables::)
* Special files in I/O redirections:
- - The `/dev/stdin', `/dev/stdout', `/dev/stderr' and
- `/dev/fd/N' special file names (*note Special Files::).
+ - The `/dev/stdin', `/dev/stdout', `/dev/stderr', and
+ `/dev/fd/N' special file names (*note Special Files::)
- The `/inet', `/inet4', and `/inet6' special files for TCP/IP
networking using `|&' to specify which version of the IP
- protocol to use (*note TCP/IP Networking::).
+ protocol to use (*note TCP/IP Networking::)
* Changes and/or additions to the language:
- - The `\x' escape sequence (*note Escape Sequences::).
+ - The `\x' escape sequence (*note Escape Sequences::)
- - Full support for both POSIX and GNU regexps (*note Regexp::).
+ - Full support for both POSIX and GNU regexps (*note Regexp::)
- The ability for `FS' and for the third argument to `split()'
- to be null strings (*note Single Character Fields::).
+ to be null strings (*note Single Character Fields::)
- - The ability for `RS' to be a regexp (*note Records::).
+ - The ability for `RS' to be a regexp (*note Records::)
- The ability to use octal and hexadecimal constants in `awk'
- program source code (*note Nondecimal-numbers::).
+ program source code (*note Nondecimal-numbers::)
- The `|&' operator for two-way I/O to a coprocess (*note
- Two-way I/O::).
+ Two-way I/O::)
- - Indirect function calls (*note Indirect Calls::).
+ - Indirect function calls (*note Indirect Calls::)
- Directories on the command line produce a warning and are
- skipped (*note Command-line directories::).
+ skipped (*note Command-line directories::)
+
+ - Output with `print' and `printf' need not be fatal (*note
+ Nonfatal::)
* New keywords:
- The `BEGINFILE' and `ENDFILE' special patterns (*note
- BEGINFILE/ENDFILE::).
+ BEGINFILE/ENDFILE::)
- - The `switch' statement (*note Switch Statement::).
+ - The `switch' statement (*note Switch Statement::)
* Changes to standard `awk' functions:
- The optional second argument to `close()' that allows closing
- one end of a two-way pipe to a coprocess (*note Two-way
- I/O::).
+ one end of a two-way pipe to a coprocess (*note Two-way I/O::)
- - POSIX compliance for `gsub()' and `sub()' with `--posix'.
+ - POSIX compliance for `gsub()' and `sub()' with `--posix'
- The `length()' function accepts an array argument and returns
- the number of elements in the array (*note String
- Functions::).
+ the number of elements in the array (*note String Functions::)
- The optional third argument to the `match()' function for
capturing text-matching subexpressions within a regexp (*note
- String Functions::).
+ String Functions::)
- Positional specifiers in `printf' formats for making
- translations easier (*note Printf Ordering::).
+ translations easier (*note Printf Ordering::)
- - The `split()' function's additional optional fourth argument
+ - The `split()' function's additional optional fourth argument,
which is an array to hold the text of the field separators
- (*note String Functions::).
+ (*note String Functions::)
* Additional functions only in `gawk':
- The `gensub()', `patsplit()', and `strtonum()' functions for
- more powerful text manipulation (*note String Functions::).
+ more powerful text manipulation (*note String Functions::)
- The `asort()' and `asorti()' functions for sorting arrays
- (*note Array Sorting::).
+ (*note Array Sorting::)
- The `mktime()', `systime()', and `strftime()' functions for
- working with timestamps (*note Time Functions::).
+ working with timestamps (*note Time Functions::)
- The `and()', `compl()', `lshift()', `or()', `rshift()', and
`xor()' functions for bit manipulation (*note Bitwise
- Functions::).
+ Functions::)
- The `isarray()' function to check if a variable is an array
- or not (*note Type Functions::).
+ or not (*note Type Functions::)
- - The `bindtextdomain()', `dcgettext()' and `dcngettext()'
- functions for internationalization (*note Programmer i18n::).
+ - The `bindtextdomain()', `dcgettext()', and `dcngettext()'
+ functions for internationalization (*note Programmer i18n::)
+
+ - The `div()' function for doing integer division and remainder
+ (*note Numeric Functions::)
* Changes and/or additions in the command-line options:
- The `AWKPATH' environment variable for specifying a path
- search for the `-f' command-line option (*note Options::).
+ search for the `-f' command-line option (*note Options::)
- The `AWKLIBPATH' environment variable for specifying a path
- search for the `-l' command-line option (*note Options::).
+ search for the `-l' command-line option (*note Options::)
- The `-b', `-c', `-C', `-d', `-D', `-e', `-E', `-g', `-h',
`-i', `-l', `-L', `-M', `-n', `-N', `-o', `-O', `-p', `-P',
`-r', `-S', `-t', and `-V' short options. Also, the ability
- to use GNU-style long-named options that start with `--' and
+ to use GNU-style long-named options that start with `--', and
the `--assign', `--bignum', `--characters-as-bytes',
`--copyright', `--debug', `--dump-variables', `--exec',
`--field-separator', `--file', `--gen-pot', `--help',
@@ -26677,12 +26773,15 @@ the current version of `gawk'.
- GCC for VAX and Alpha has not been tested for a while.
- * Support for the following obsolete systems was removed from the
- code for `gawk' version 4.1:
+ * Support for the following obsolete system was removed from the code
+ for `gawk' version 4.1:
- Ultrix
- * Support for MirBSD was removed at `gawk' version 4.2.
+ * Support for the following systems was removed from the code for
+ `gawk' version 4.2:
+
+ - MirBSD

@@ -27069,6 +27168,28 @@ in POSIX `awk', in the order they were added to `gawk'.
* The dynamic extension interface was completely redone (*note
Dynamic Extensions::).
+ * Support for Ultrix was removed.
+
+
+ Version 4.2 introduced the following changes:
+
+ * Changes to `ENVIRON' are reflected into `gawk''s environment and
+ that of programs that it runs. *Note Auto-set::.
+
+ * The `--pretty-print' option no longer runs the `awk' program too.
+ *Note Options::.
+
+ * The `igawk' program and its manual page are no longer installed
+ when `gawk' is built. *Note Igawk Program::.
+
+ * The `div()' function. *Note Numeric Functions::.
+
+ * The maximum number of hexdecimal digits in `\x' escapes is now two.
+ *Note Escape Sequences::.
+
+ * Nonfatal output with `print' and `printf'. *Note Nonfatal::.
+
+ * Support for MirBSD was removed.

File: gawk.info, Node: Common Extensions, Next: Ranges and Locales, Prev: Feature History, Up: Language History
@@ -27080,22 +27201,22 @@ The following table summarizes the common extensions supported by
`gawk', Brian Kernighan's `awk', and `mawk', the three most widely used
freely available versions of `awk' (*note Other Versions::).
-Feature BWK Awk Mawk GNU Awk Now standard
------------------------------------------------------------------------
-`\x' Escape sequence X X X
-`FS' as null string X X X
-`/dev/stdin' special file X X X
-`/dev/stdout' special file X X X
-`/dev/stderr' special file X X X
-`delete' without subscript X X X X
-`fflush()' function X X X X
-`length()' of an array X X X
-`nextfile' statement X X X X
-`**' and `**=' operators X X
-`func' keyword X X
-`BINMODE' variable X X
-`RS' as regexp X X
-Time-related functions X X
+Feature BWK `awk' `mawk' `gawk' Now standard
+--------------------------------------------------------------------------
+`\x' escape sequence X X X
+`FS' as null string X X X
+`/dev/stdin' special file X X X
+`/dev/stdout' special file X X X
+`/dev/stderr' special file X X X
+`delete' without subscript X X X X
+`fflush()' function X X X X
+`length()' of an array X X X
+`nextfile' statement X X X X
+`**' and `**=' operators X X
+`func' keyword X X
+`BINMODE' variable X X
+`RS' as regexp X X
+Time-related functions X X

File: gawk.info, Node: Ranges and Locales, Next: Contributors, Prev: Common Extensions, Up: Language History
@@ -27115,7 +27236,7 @@ in the machine's native character set. Thus, on ASCII-based systems,
`[a-z]' matched all the lowercase letters, and only the lowercase
letters, as the numeric values for the letters from `a' through `z'
were contiguous. (On an EBCDIC system, the range `[a-z]' includes
-additional, non-alphabetic characters as well.)
+additional nonalphabetic characters as well.)
Almost all introductory Unix literature explained range expressions
as working in this fashion, and in particular, would teach that the
@@ -27139,7 +27260,7 @@ outside those locales, the ordering was defined to be based on
What does that mean? In many locales, `A' and `a' are both less
than `B'. In other words, these locales sort characters in dictionary
order, and `[a-dx-z]' is typically not equivalent to `[abcdxyz]';
-instead it might be equivalent to `[ABCXYabcdxyz]', for example.
+instead, it might be equivalent to `[ABCXYabcdxyz]', for example.
This point needs to be emphasized: much literature teaches that you
should use `[a-z]' to match a lowercase character. But on systems with
@@ -27163,17 +27284,17 @@ is perfectly valid in ASCII, but is not valid in many Unicode locales,
such as `en_US.UTF-8'.
Early versions of `gawk' used regexp matching code that was not
-locale aware, so ranges had their traditional interpretation.
+locale-aware, so ranges had their traditional interpretation.
When `gawk' switched to using locale-aware regexp matchers, the
problems began; especially as both GNU/Linux and commercial Unix
vendors started implementing non-ASCII locales, _and making them the
default_. Perhaps the most frequently asked question became something
-like "why does `[A-Z]' match lowercase letters?!?"
+like, "Why does `[A-Z]' match lowercase letters?!?"
This situation existed for close to 10 years, if not more, and the
`gawk' maintainer grew weary of trying to explain that `gawk' was being
-nicely standards compliant, and that the issue was in the user's
+nicely standards-compliant, and that the issue was in the user's
locale. During the development of version 4.0, he modified `gawk' to
always treat ranges in the original, pre-POSIX fashion, unless
`--posix' was used (*note Options::).(2)
@@ -27185,18 +27306,18 @@ of range expressions was _undefined_.(3)
By using this lovely technical term, the standard gives license to
implementors to implement ranges in whatever way they choose. The
-`gawk' maintainer chose to apply the pre-POSIX meaning in all cases:
-the default regexp matching; with `--traditional' and with `--posix';
-in all cases, `gawk' remains POSIX compliant.
+`gawk' maintainer chose to apply the pre-POSIX meaning both with the
+default regexp matching and when `--traditional' or `--posix' are used.
+In all cases `gawk' remains POSIX-compliant.
---------- Footnotes ----------
(1) And Life was good.
(2) And thus was born the Campaign for Rational Range Interpretation
-(or RRI). A number of GNU tools have either implemented this change, or
-will soon. Thanks to Karl Berry for coining the phrase "Rational Range
-Interpretation."
+(or RRI). A number of GNU tools have already implemented this change,
+or will soon. Thanks to Karl Berry for coining the phrase "Rational
+Range Interpretation."
(3) See the standard
(http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05)
@@ -27228,7 +27349,7 @@ Info file, in approximate chronological order:
* Richard Stallman helped finish the implementation and the initial
draft of this Info file. He is also the founder of the FSF and
- the GNU project.
+ the GNU Project.
* John Woods contributed parts of the code (mostly fixes) in the
initial version of `gawk'.
@@ -27314,22 +27435,22 @@ Info file, in approximate chronological order:
* John Haque made the following contributions:
- The modifications to convert `gawk' into a byte-code
- interpreter, including the debugger.
+ interpreter, including the debugger
- - The addition of true arrays of arrays.
+ - The addition of true arrays of arrays
- The additional modifications for support of
- arbitrary-precision arithmetic.
+ arbitrary-precision arithmetic
- - The initial text of *note Arbitrary Precision Arithmetic::.
+ - The initial text of *note Arbitrary Precision Arithmetic::
- The work to merge the three versions of `gawk' into one, for
- the 4.1 release.
+ the 4.1 release
- - Improved array internals for arrays indexed by integers.
+ - Improved array internals for arrays indexed by integers
- - The improved array sorting features were driven by John
- together with Pat Rankin.
+ - The improved array sorting features were also driven by John,
+ together with Pat Rankin
* Panos Papadopoulos contributed the original text for *note Include
Files::.
@@ -27358,11 +27479,11 @@ A.10 Summary
============
* The `awk' language has evolved over time. The first release was
- with V7 Unix circa 1978. In 1987, for System V Release 3.1, major
- additions, including user-defined functions, were made to the
- language. Additional changes were made for System V Release 4, in
- 1989. Since then, further minor changes happen under the auspices
- of the POSIX standard.
+ with V7 Unix, circa 1978. In 1987, for System V Release 3.1,
+ major additions, including user-defined functions, were made to
+ the language. Additional changes were made for System V Release
+ 4, in 1989. Since then, further minor changes have happened under
+ the auspices of the POSIX standard.
* Brian Kernighan's `awk' provides a small number of extensions that
are implemented in common with other versions of `awk'.
@@ -27375,7 +27496,7 @@ A.10 Summary
been confusing over the years. Today, `gawk' implements Rational
Range Interpretation, where ranges of the form `[a-z]' match
_only_ the characters numerically between `a' through `z' in the
- machine's native character set. Usually this is ASCII but it can
+ machine's native character set. Usually this is ASCII, but it can
be EBCDIC on IBM S/390 systems.
* Many people have contributed to `gawk' development over the years.
@@ -27453,7 +27574,7 @@ B.1.2 Extracting the Distribution
`gawk' is distributed as several `tar' files compressed with different
compression programs: `gzip', `bzip2', and `xz'. For simplicity, the
rest of these instructions assume you are using the one compressed with
-the GNU Zip program, `gzip'.
+the GNU Gzip program (`gzip').
Once you have the distribution (e.g., `gawk-4.1.2.tar.gz'), use
`gzip' to expand the file and then use `tar' to extract it. You can
@@ -27493,10 +27614,10 @@ files, subdirectories, and files related to the configuration process
to different non-Unix operating systems:
Various `.c', `.y', and `.h' files
- The actual `gawk' source code.
+ These files contain the actual `gawk' source code.
`ABOUT-NLS'
- Information about GNU `gettext' and translations.
+ A file containing information about GNU `gettext' and translations.
`AUTHORS'
A file with some information about the authorship of `gawk'. It
@@ -27528,7 +27649,7 @@ Various `.c', `.y', and `.h' files
The GNU General Public License.
`POSIX.STD'
- A description of behaviors in the POSIX standard for `awk' which
+ A description of behaviors in the POSIX standard for `awk' that
are left undefined, or where `gawk' may not comply fully, as well
as a list of things that the POSIX standard should describe but
does not.
@@ -27792,14 +27913,16 @@ command line when compiling `gawk' from scratch, including:
do nothing. Similarly, setting the `LINT' variable (*note
User-modified::) has no effect on the running `awk' program.
- When used with GCC's automatic dead-code-elimination, this option
- cuts almost 23K bytes off the size of the `gawk' executable on
- GNU/Linux x86_64 systems. Results on other systems and with other
- compilers are likely to vary. Using this option may bring you
- some slight performance improvement.
+ When used with the GNU Compiler Collection's (GCC's) automatic
+ dead-code-elimination, this option cuts almost 23K bytes off the
+ size of the `gawk' executable on GNU/Linux x86_64 systems.
+ Results on other systems and with other compilers are likely to
+ vary. Using this option may bring you some slight performance
+ improvement.
- Using this option will cause some of the tests in the test suite
- to fail. This option may be removed at a later date.
+ CAUTION: Using this option will cause some of the tests in
+ the test suite to fail. This option may be removed at a
+ later date.
`--disable-nls'
Disable all message-translation facilities. This is usually not
@@ -27883,10 +28006,10 @@ B.3.1 Installation on PC Operating Systems
This minor node covers installation and usage of `gawk' on Intel
architecture machines running MS-DOS, any version of MS-Windows, or
OS/2. In this minor node, the term "Windows32" refers to any of
-Microsoft Windows-95/98/ME/NT/2000/XP/Vista/7/8.
+Microsoft Windows 95/98/ME/NT/2000/XP/Vista/7/8.
The limitations of MS-DOS (and MS-DOS shells under the other
-operating systems) has meant that various "DOS extenders" are often
+operating systems) have meant that various "DOS extenders" are often
used with programs such as `gawk'. The varying capabilities of
Microsoft Windows 3.1 and Windows32 can add to the confusion. For an
overview of the considerations, refer to `README_d/README.pc' in the
@@ -28081,7 +28204,7 @@ The DJGPP collection of tools includes an MS-DOS port of Bash, and
several shells are available for OS/2, including `ksh'.
Under MS-Windows, OS/2 and MS-DOS, `gawk' (and many other text
-programs) silently translate end-of-line `\r\n' to `\n' on input and
+programs) silently translates end-of-line `\r\n' to `\n' on input and
`\n' to `\r\n' on output. A special `BINMODE' variable (c.e.) allows
control over these translations and is interpreted as follows:
@@ -28103,7 +28226,7 @@ The modes for standard input and standard output are set one time only
program). Setting `BINMODE' for standard input or standard output is
accomplished by using an appropriate `-v BINMODE=N' option on the
command line. `BINMODE' is set at the time a file or pipe is opened
-and cannot be changed mid-stream.
+and cannot be changed midstream.
The name `BINMODE' was chosen to match `mawk' (*note Other
Versions::). `mawk' and `gawk' handle `BINMODE' similarly; however,
@@ -28147,10 +28270,9 @@ B.3.1.5 Using `gawk' In The Cygwin Environment
`gawk' can be built and used "out of the box" under MS-Windows if you
are using the Cygwin environment (http://www.cygwin.com). This
-environment provides an excellent simulation of GNU/Linux, using the
-GNU tools, such as Bash, the GNU Compiler Collection (GCC), GNU Make,
-and other GNU programs. Compilation and installation for Cygwin is the
-same as for a Unix system:
+environment provides an excellent simulation of GNU/Linux, using Bash,
+GCC, GNU Make, and other GNU programs. Compilation and installation
+for Cygwin is the same as for a Unix system:
tar -xvpzf gawk-4.1.2.tar.gz
cd gawk-4.1.2
@@ -28168,7 +28290,7 @@ B.3.1.6 Using `gawk' In The MSYS Environment
............................................
In the MSYS environment under MS-Windows, `gawk' automatically uses
-binary mode for reading and writing files. Thus there is no need to
+binary mode for reading and writing files. Thus, there is no need to
use the `BINMODE' variable.
This can cause problems with other Unix-like components that have
@@ -28223,9 +28345,9 @@ available from `https://github.com/endlesssoftware/mmk'.
target parameter may need to be exact.
`gawk' has been tested under VAX/VMS 7.3 and Alpha/VMS 7.3-1 using
-Compaq C V6.4, and Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3.
-The most recent builds used HP C V7.3 on Alpha VMS 8.3 and both Alpha
-and IA64 VMS 8.4 used HP C 7.3.(1)
+Compaq C V6.4, and under Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS
+8.3. The most recent builds used HP C V7.3 on Alpha VMS 8.3 and both
+Alpha and IA64 VMS 8.4 used HP C 7.3.(1)
*Note VMS GNV::, for information on building `gawk' as a PCSI kit
that is compatible with the GNV product.
@@ -28268,7 +28390,7 @@ than 32 bits.
/name=(as_is,short)
- Compile time macros need to be defined before the first VMS-supplied
+ Compile-time macros need to be defined before the first VMS-supplied
header file is included, as follows:
#if (__CRTL_VER >= 70200000) && !defined (__VAX)
@@ -28312,14 +28434,14 @@ directory tree, the program will be known as
`GNV$GNU:[vms_help]gawk.hlp'.
The PCSI kit also installs a `GNV$GNU:[vms_bin]gawk_verb.cld' file
-which can be used to add `gawk' and `awk' as DCL commands.
+that can be used to add `gawk' and `awk' as DCL commands.
For just the current process you can use:
$ set command gnv$gnu:[vms_bin]gawk_verb.cld
Or the system manager can use `GNV$GNU:[vms_bin]gawk_verb.cld' to
-add the `gawk' and `awk' to the system wide `DCLTABLES'.
+add the `gawk' and `awk' to the system-wide `DCLTABLES'.
The DCL syntax is documented in the `gawk.hlp' file.
@@ -28379,14 +28501,14 @@ process) are present, there is no ambiguity and `--' can be omitted.
status value when the program exits.
The VMS severity bits will be set based on the `exit' value. A
-failure is indicated by 1 and VMS sets the `ERROR' status. A fatal
-error is indicated by 2 and VMS sets the `FATAL' status. All other
+failure is indicated by 1, and VMS sets the `ERROR' status. A fatal
+error is indicated by 2, and VMS sets the `FATAL' status. All other
values will have the `SUCCESS' status. The exit value is encoded to
comply with VMS coding standards and will have the `C_FACILITY_NO' of
`0x350000' with the constant `0xA000' added to the number shifted over
by 3 bits to make room for the severity codes.
- To extract the actual `gawk' exit code from the VMS status use:
+ To extract the actual `gawk' exit code from the VMS status, use:
unix_status = (vms_status .and. &x7f8) / 8
@@ -28402,7 +28524,7 @@ Function::.
VMS reports time values in GMT unless one of the `SYS$TIMEZONE_RULE'
or `TZ' logical names is set. Older versions of VMS, such as VAX/VMS
-7.3 do not set these logical names.
+7.3, do not set these logical names.
The default search path, when looking for `awk' program files
specified by the `-f' option, is `"SYS$DISK:[],AWK_LIBRARY:"'. The
@@ -28419,7 +28541,7 @@ B.3.2.5 The VMS GNV Project
The VMS GNV package provides a build environment similar to POSIX with
ports of a collection of open source tools. The `gawk' found in the GNV
-base kit is an older port. Currently the GNV project is being
+base kit is an older port. Currently, the GNV project is being
reorganized to supply individual PCSI packages for each component. See
`https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/'.
@@ -28453,7 +28575,7 @@ B.4 Reporting Problems and Bugs
Douglas Adams, `The Hitchhiker's Guide to the Galaxy'
If you have problems with `gawk' or think that you have found a bug,
-report it to the developers; we cannot promise to do anything but we
+report it to the developers; we cannot promise to do anything, but we
might well want to fix it.
Before reporting a bug, make sure you have really found a genuine
@@ -28464,7 +28586,7 @@ documentation!
Before reporting a bug or trying to fix it yourself, try to isolate
it to the smallest possible `awk' program and input data file that
-reproduces the problem. Then send us the program and data file, some
+reproduce the problem. Then send us the program and data file, some
idea of what kind of Unix system you're using, the compiler you used to
compile `gawk', and the exact results `gawk' gave you. Also say what
you expected to occur; this helps us decide whether the problem is
@@ -28476,7 +28598,7 @@ You can get this information with the command `gawk --version'.
Once you have a precise problem description, send email to
<bug-gawk@gnu.org>.
- The `gawk' maintainers subscribe to this address and thus they will
+ The `gawk' maintainers subscribe to this address, and thus they will
receive your bug report. Although you can send mail to the maintainers
directly, the bug reporting address is preferred because the email list
is archived at the GNU Project. _All email must be in English. This is
@@ -28497,8 +28619,8 @@ the only language understood in common by all the maintainers._
forward bug reports "upstream" to the GNU mailing list, many
don't, so there is a good chance that the `gawk' maintainers
won't even see the bug report! Second, mail to the GNU list is
- archived, and having everything at the GNU project keeps things
- self-contained and not dependant on other organizations.
+ archived, and having everything at the GNU Project keeps things
+ self-contained and not dependent on other organizations.
Non-bug suggestions are always welcome as well. If you have
questions about things that are unclear in the documentation or are
@@ -28507,18 +28629,19 @@ if we can.
If you find bugs in one of the non-Unix ports of `gawk', send an
email to the bug list, with a copy to the person who maintains that
-port. They are named in the following list, as well as in the `README'
-file in the `gawk' distribution. Information in the `README' file
-should be considered authoritative if it conflicts with this Info file.
+port. The maintainers are named in the following list, as well as in
+the `README' file in the `gawk' distribution. Information in the
+`README' file should be considered authoritative if it conflicts with
+this Info file.
The people maintaining the various `gawk' ports are:
-Unix and POSIX systems Arnold Robbins, <arnold@skeeve.com>.
-MS-DOS with DJGPP Scott Deifik, <scottd.mail@sbcglobal.net>.
-MS-Windows with MinGW Eli Zaretskii, <eliz@gnu.org>.
-OS/2 Andreas Buening, <andreas.buening@nexgo.de>.
-VMS John Malmberg, <wb8tyw@qsl.net>.
-z/OS (OS/390) Dave Pitts, <dpitts@cozx.com>.
+Unix and POSIX systems Arnold Robbins, <arnold@skeeve.com>
+MS-DOS with DJGPP Scott Deifik, <scottd.mail@sbcglobal.net>
+MS-Windows with MinGW Eli Zaretskii, <eliz@gnu.org>
+OS/2 Andreas Buening, <andreas.buening@nexgo.de>
+VMS John Malmberg, <wb8tyw@qsl.net>
+z/OS (OS/390) Dave Pitts, <dpitts@cozx.com>
If your bug is also reproducible under Unix, send a copy of your
report to the <bug-gawk@gnu.org> email list as well.
@@ -28529,7 +28652,7 @@ File: gawk.info, Node: Other Versions, Next: Installation summary, Prev: Bugs
B.5 Other Freely Available `awk' Implementations
================================================
- It's kind of fun to put comments like this in your awk code.
+ It's kind of fun to put comments like this in your awk code:
`// Do C++ comments work? answer: yes! of course' -- Michael
Brennan
@@ -28552,7 +28675,7 @@ Unix `awk'
Zip file
`http://www.cs.princeton.edu/~bwk/btl.mirror/awk.zip'
- You can also retrieve it from Git Hub:
+ You can also retrieve it from GitHub:
git clone git://github.com/onetrueawk/awk bwkawk
@@ -28594,7 +28717,7 @@ Unix `awk'
`awka'
Written by Andrew Sumner, `awka' translates `awk' programs into C,
compiles them, and links them with a library of functions that
- provides the core `awk' functionality. It also has a number of
+ provide the core `awk' functionality. It also has a number of
extensions.
The `awk' translator is released under the GPL, and the library is
@@ -28608,14 +28731,14 @@ Unix `awk'
`pawk'
Nelson H.F. Beebe at the University of Utah has modified BWK `awk'
to provide timing and profiling information. It is different from
- `gawk' with the `--profile' option (*note Profiling::), in that it
+ `gawk' with the `--profile' option (*note Profiling::) in that it
uses CPU-based profiling, not line-count profiling. You may find
it at either
`ftp://ftp.math.utah.edu/pub/pawk/pawk-20030606.tar.gz' or
`http://www.math.utah.edu/pub/pawk/pawk-20030606.tar.gz'.
-Busybox Awk
- Busybox is a GPL-licensed program providing small versions of many
+BusyBox `awk'
+ BusyBox is a GPL-licensed program providing small versions of many
applications within a single executable. It is aimed at embedded
systems. It includes a full implementation of POSIX `awk'. When
building it, be careful not to do `make install' as it will
@@ -28625,7 +28748,7 @@ Busybox Awk
The OpenSolaris POSIX `awk'
The versions of `awk' in `/usr/xpg4/bin' and `/usr/xpg6/bin' on
- Solaris are more-or-less POSIX-compliant. They are based on the
+ Solaris are more or less POSIX-compliant. They are based on the
`awk' from Mortice Kern Systems for PCs. We were able to make
this code compile and work under GNU/Linux with 1-2 hours of work.
Making it more generally portable (using GNU Autoconf and/or
@@ -28657,7 +28780,7 @@ Libmawk
information. (This is not related to Nelson Beebe's modified
version of BWK `awk', described earlier.)
-QSE Awk
+QSE `awk'
This is an embeddable `awk' interpreter. For more information, see
`http://code.google.com/p/qse/' and `http://awk.info/?tools/qse'.
@@ -28675,7 +28798,7 @@ Other versions
See also the "Versions and implementations" section of the
Wikipedia article
(http://en.wikipedia.org/wiki/Awk_language#Versions_and_implementations)
- for information on additional versions.
+ on `awk' for information on additional versions.

@@ -28684,7 +28807,7 @@ File: gawk.info, Node: Installation summary, Prev: Other Versions, Up: Instal
B.6 Summary
===========
- * The `gawk' distribution is available from GNU project's main
+ * The `gawk' distribution is available from the GNU Project's main
distribution site, `ftp.gnu.org'. The canonical build recipe is:
wget http://ftp.gnu.org/gnu/gawk/gawk-4.1.2.tar.gz
@@ -28693,17 +28816,17 @@ B.6 Summary
./configure && make && make check
* `gawk' may be built on non-POSIX systems as well. The currently
- supported systems are MS-Windows using DJGPP, MSYS, MinGW and
+ supported systems are MS-Windows using DJGPP, MSYS, MinGW, and
Cygwin, OS/2 using EMX, and both Vax/VMS and OpenVMS.
Instructions for each system are included in this major node.
* Bug reports should be sent via email to <bug-gawk@gnu.org>. Bug
- reports should be in English, and should include the version of
+ reports should be in English and should include the version of
`gawk', how it was compiled, and a short program and data file
- which demonstrate the problem.
+ that demonstrate the problem.
* There are a number of other freely available `awk'
- implementations. Many are POSIX compliant; others are less so.
+ implementations. Many are POSIX-compliant; others are less so.

@@ -31755,7 +31878,7 @@ Index
* --disable-lint configuration option: Additional Configuration Options.
(line 15)
* --disable-nls configuration option: Additional Configuration Options.
- (line 30)
+ (line 32)
* --dump-variables option: Options. (line 93)
* --dump-variables option, using for library functions: Library Names.
(line 45)
@@ -31793,7 +31916,7 @@ Index
* --use-lc-numeric option: Options. (line 220)
* --version option: Options. (line 300)
* --with-whiny-user-strftime configuration option: Additional Configuration Options.
- (line 35)
+ (line 37)
* -b option: Options. (line 68)
* -C option: Options. (line 88)
* -c option: Options. (line 81)
@@ -31829,7 +31952,7 @@ Index
* -W option: Options. (line 46)
* . (period), regexp operator: Regexp Operators. (line 44)
* .gmo files: Explaining gettext. (line 42)
-* .gmo files, specifying directory of <1>: Programmer i18n. (line 47)
+* .gmo files, specifying directory of <1>: Programmer i18n. (line 48)
* .gmo files, specifying directory of: Explaining gettext. (line 54)
* .mo files, converting from .po: I18N Example. (line 64)
* .po files <1>: Translator i18n. (line 6)
@@ -32211,7 +32334,7 @@ Index
* BEGIN pattern, and profiling: Profiling. (line 62)
* BEGIN pattern, assert() user-defined function and: Assert Function.
(line 83)
-* BEGIN pattern, Boolean patterns and: Expression Patterns. (line 69)
+* BEGIN pattern, Boolean patterns and: Expression Patterns. (line 70)
* BEGIN pattern, exit statement and: Exit Statement. (line 12)
* BEGIN pattern, getline and: Getline Notes. (line 19)
* BEGIN pattern, headings, adding: Print Examples. (line 43)
@@ -32228,14 +32351,14 @@ Index
* BEGIN pattern, TEXTDOMAIN variable and: Programmer i18n. (line 60)
* BEGINFILE pattern: BEGINFILE/ENDFILE. (line 6)
* BEGINFILE pattern, Boolean patterns and: Expression Patterns.
- (line 69)
-* beginfile() user-defined function: Filetrans Function. (line 61)
+ (line 70)
+* beginfile() user-defined function: Filetrans Function. (line 62)
* Bentley, Jon: Glossary. (line 207)
* Benzinger, Michael: Contributors. (line 97)
* Berry, Karl <1>: Ranges and Locales. (line 74)
* Berry, Karl: Acknowledgments. (line 33)
* binary input/output: User-modified. (line 15)
-* bindtextdomain <1>: Programmer i18n. (line 47)
+* bindtextdomain <1>: Programmer i18n. (line 48)
* bindtextdomain: I18N Functions. (line 12)
* bindtextdomain() function (C library): Explaining gettext. (line 50)
* bindtextdomain() function (gawk), portability and: I18N Portability.
@@ -32254,7 +32377,7 @@ Index
* body, in actions: Statements. (line 10)
* body, in loops: While Statement. (line 14)
* Boolean expressions: Boolean Ops. (line 6)
-* Boolean expressions, as patterns: Expression Patterns. (line 38)
+* Boolean expressions, as patterns: Expression Patterns. (line 39)
* Boolean operators, See Boolean expressions: Boolean Ops. (line 6)
* Bourne shell, quoting rules for: Quoting. (line 18)
* braces ({}): Profiling. (line 142)
@@ -32314,7 +32437,7 @@ Index
* Brown, Martin: Contributors. (line 82)
* 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 <1>: Bugs. (line 71)
* Buening, Andreas <2>: Contributors. (line 92)
* Buening, Andreas: Acknowledgments. (line 60)
* buffering, input/output <1>: Two-way I/O. (line 52)
@@ -32327,7 +32450,7 @@ Index
* bug-gawk@gnu.org bug reporting address: Bugs. (line 30)
* built-in functions: Functions. (line 6)
* built-in functions, evaluation order: Calling Built-in. (line 30)
-* Busybox Awk: Other Versions. (line 92)
+* BusyBox Awk: Other Versions. (line 92)
* c.e., See common extensions: Conventions. (line 51)
* call by reference: Pass By Value/Reference.
(line 44)
@@ -32459,9 +32582,9 @@ Index
* configuration option, --disable-lint: Additional Configuration Options.
(line 15)
* configuration option, --disable-nls: Additional Configuration Options.
- (line 30)
+ (line 32)
* configuration option, --with-whiny-user-strftime: Additional Configuration Options.
- (line 35)
+ (line 37)
* configuration options, gawk: Additional Configuration Options.
(line 6)
* constant regexps: Regexp Usage. (line 57)
@@ -32569,11 +32692,11 @@ Index
* Davies, Stephen <1>: Contributors. (line 74)
* Davies, Stephen: Acknowledgments. (line 60)
* Day, Robert P.J.: Acknowledgments. (line 78)
-* dcgettext <1>: Programmer i18n. (line 19)
+* dcgettext <1>: Programmer i18n. (line 20)
* dcgettext: I18N Functions. (line 22)
* dcgettext() function (gawk), portability and: I18N Portability.
(line 33)
-* dcngettext <1>: Programmer i18n. (line 36)
+* dcngettext <1>: Programmer i18n. (line 37)
* dcngettext: I18N Functions. (line 28)
* dcngettext() function (gawk), portability and: I18N Portability.
(line 33)
@@ -32660,7 +32783,7 @@ Index
* debugger commands, t (tbreak): Breakpoint Control. (line 90)
* debugger commands, tbreak: Breakpoint Control. (line 90)
* debugger commands, trace: Miscellaneous Debugger Commands.
- (line 108)
+ (line 107)
* debugger commands, u (until): Debugger Execution Control.
(line 83)
* debugger commands, undisplay: Viewing And Changing Data.
@@ -32676,18 +32799,18 @@ Index
(line 67)
* debugger commands, where (backtrace): Execution Stack. (line 13)
* debugger default list amount: Debugger Info. (line 69)
-* debugger history file: Debugger Info. (line 80)
+* debugger history file: Debugger Info. (line 81)
* debugger history size: Debugger Info. (line 65)
* debugger options: Debugger Info. (line 57)
-* debugger prompt: Debugger Info. (line 77)
+* debugger prompt: Debugger Info. (line 78)
* debugger, how to start: Debugger Invocation. (line 6)
-* debugger, read commands from a file: Debugger Info. (line 96)
+* debugger, read commands from a file: Debugger Info. (line 97)
* debugging awk programs: Debugger. (line 6)
* debugging gawk, bug reports: Bugs. (line 9)
* decimal point character, locale specific: Options. (line 270)
* decrement operators: Increment Ops. (line 35)
* default keyword: Switch Statement. (line 6)
-* Deifik, Scott <1>: Bugs. (line 70)
+* Deifik, Scott <1>: Bugs. (line 71)
* Deifik, Scott <2>: Contributors. (line 53)
* Deifik, Scott: Acknowledgments. (line 60)
* delete ARRAY: Delete. (line 39)
@@ -32746,7 +32869,7 @@ Index
(line 6)
* differences in awk and gawk, line continuations: Conditional Exp.
(line 34)
-* differences in awk and gawk, LINT variable: User-modified. (line 88)
+* differences in awk and gawk, LINT variable: User-modified. (line 87)
* differences in awk and gawk, match() function: String Functions.
(line 263)
* differences in awk and gawk, print/printf statements: Format Modifiers.
@@ -32773,7 +32896,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 152)
+ (line 151)
* differences in awk and gawk, trunc-mod operation: Arithmetic Ops.
(line 66)
* directories, command-line: Command-line directories.
@@ -32841,7 +32964,7 @@ Index
* END pattern, and profiling: Profiling. (line 62)
* END pattern, assert() user-defined function and: Assert Function.
(line 75)
-* END pattern, Boolean patterns and: Expression Patterns. (line 69)
+* END pattern, Boolean patterns and: Expression Patterns. (line 70)
* END pattern, exit statement and: Exit Statement. (line 12)
* END pattern, next/nextfile statements and <1>: Next Statement.
(line 44)
@@ -32850,10 +32973,10 @@ Index
* END pattern, operators and: Using BEGIN/END. (line 17)
* END pattern, print statement and: I/O And BEGIN/END. (line 16)
* ENDFILE pattern: BEGINFILE/ENDFILE. (line 6)
-* ENDFILE pattern, Boolean patterns and: Expression Patterns. (line 69)
-* endfile() user-defined function: Filetrans Function. (line 61)
-* endgrent() function (C library): Group Functions. (line 211)
-* endgrent() user-defined function: Group Functions. (line 214)
+* ENDFILE pattern, Boolean patterns and: Expression Patterns. (line 70)
+* endfile() user-defined function: Filetrans Function. (line 62)
+* endgrent() function (C library): Group Functions. (line 212)
+* endgrent() user-defined function: Group Functions. (line 215)
* endpwent() function (C library): Passwd Functions. (line 207)
* endpwent() user-defined function: Passwd Functions. (line 210)
* English, Steve: Advanced Features. (line 6)
@@ -32909,7 +33032,7 @@ Index
(line 99)
* exp: Numeric Functions. (line 33)
* expand utility: Very Simple. (line 73)
-* Expat XML parser library: gawkextlib. (line 33)
+* Expat XML parser library: gawkextlib. (line 35)
* exponent: Numeric Functions. (line 33)
* expressions: Expressions. (line 6)
* expressions, as patterns: Expression Patterns. (line 6)
@@ -33014,7 +33137,7 @@ Index
* FILENAME variable, getline, setting with: Getline Notes. (line 19)
* filenames, assignments as: Ignoring Assigns. (line 6)
* files, .gmo: Explaining gettext. (line 42)
-* files, .gmo, specifying directory of <1>: Programmer i18n. (line 47)
+* files, .gmo, specifying directory of <1>: Programmer i18n. (line 48)
* files, .gmo, specifying directory of: Explaining gettext. (line 54)
* files, .mo, converting from .po: I18N Example. (line 64)
* files, .po <1>: Translator i18n. (line 6)
@@ -33041,7 +33164,7 @@ Index
* files, message object, converting from portable object files: I18N Example.
(line 64)
* files, message object, specifying directory of <1>: Programmer i18n.
- (line 47)
+ (line 48)
* files, message object, specifying directory of: Explaining gettext.
(line 54)
* files, multiple passes over: Other Arguments. (line 56)
@@ -33236,7 +33359,7 @@ Index
(line 6)
* gawk, interval expressions and: Regexp Operators. (line 139)
* gawk, line continuation in: Conditional Exp. (line 34)
-* gawk, LINT variable in: User-modified. (line 88)
+* gawk, LINT variable in: User-modified. (line 87)
* gawk, list of contributors to: Contributors. (line 6)
* gawk, MS-DOS version of: PC Using. (line 10)
* gawk, MS-Windows version of: PC Using. (line 10)
@@ -33262,7 +33385,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 152)
+* gawk, TEXTDOMAIN variable in: User-modified. (line 151)
* gawk, timestamps: Time Functions. (line 6)
* gawk, uses for: Preface. (line 34)
* gawk, versions of, information about, printing: Options. (line 300)
@@ -33287,12 +33410,12 @@ Index
* getaddrinfo() function (C library): TCP/IP Networking. (line 38)
* getgrent() function (C library): Group Functions. (line 6)
* getgrent() user-defined function: Group Functions. (line 6)
-* getgrgid() function (C library): Group Functions. (line 182)
-* getgrgid() user-defined function: Group Functions. (line 185)
-* getgrnam() function (C library): Group Functions. (line 171)
-* getgrnam() user-defined function: Group Functions. (line 176)
-* getgruser() function (C library): Group Functions. (line 191)
-* getgruser() function, user-defined: Group Functions. (line 194)
+* getgrgid() function (C library): Group Functions. (line 183)
+* getgrgid() user-defined function: Group Functions. (line 186)
+* getgrnam() function (C library): Group Functions. (line 172)
+* getgrnam() user-defined function: Group Functions. (line 177)
+* getgruser() function (C library): Group Functions. (line 192)
+* getgruser() function, user-defined: Group Functions. (line 195)
* getline command: Reading Files. (line 20)
* getline command, _gr_init() user-defined function: Group Functions.
(line 83)
@@ -33329,7 +33452,7 @@ Index
* git utility <2>: Accessing The Source.
(line 10)
* git utility <3>: Other Versions. (line 29)
-* git utility: gawkextlib. (line 27)
+* git utility: gawkextlib. (line 29)
* Git, use of for gawk source code: Derived Files. (line 6)
* GNITS mailing list: Acknowledgments. (line 52)
* GNU awk, See gawk: Preface. (line 51)
@@ -33385,7 +33508,7 @@ Index
* hyphen (-), in bracket expressions: Bracket Expressions. (line 17)
* i debugger command (alias for info): Debugger Info. (line 13)
* id utility: Id Program. (line 6)
-* id.awk program: Id Program. (line 30)
+* id.awk program: Id Program. (line 31)
* if statement: If Statement. (line 6)
* if statement, actions, changing: Ranges. (line 25)
* if statement, use of regexps in: Regexp Usage. (line 19)
@@ -33453,7 +33576,7 @@ Index
* insomnia, cure for: Alarm Program. (line 6)
* installation, VMS: VMS Installation. (line 6)
* installing gawk: Installation. (line 6)
-* instruction tracing, in debugger: Debugger Info. (line 89)
+* instruction tracing, in debugger: Debugger Info. (line 90)
* int: Numeric Functions. (line 38)
* INT signal (MS-Windows): Profiling. (line 213)
* integer array indices: Numeric Array Subscripts.
@@ -33466,7 +33589,7 @@ Index
* internationalization: I18N Functions. (line 6)
* internationalization, localization <1>: Internationalization.
(line 13)
-* internationalization, localization: User-modified. (line 152)
+* internationalization, localization: User-modified. (line 151)
* internationalization, localization, character classes: Bracket Expressions.
(line 101)
* internationalization, localization, gawk and: Internationalization.
@@ -33474,7 +33597,7 @@ Index
* internationalization, localization, locale categories: Explaining gettext.
(line 81)
* internationalization, localization, marked strings: Programmer i18n.
- (line 14)
+ (line 13)
* internationalization, localization, portability and: I18N Portability.
(line 6)
* internationalizing a program: Explaining gettext. (line 6)
@@ -33576,7 +33699,7 @@ Index
* lines, duplicate, removing: History Sorting. (line 6)
* lines, matching ranges of: Ranges. (line 6)
* lines, skipping between markers: Ranges. (line 43)
-* lint checking: User-modified. (line 88)
+* lint checking: User-modified. (line 87)
* lint checking, array elements: Delete. (line 34)
* lint checking, array subscripts: Uninitialized Subscripts.
(line 43)
@@ -33586,7 +33709,7 @@ Index
(line 339)
* lint checking, undefined functions: Pass By Value/Reference.
(line 85)
-* LINT variable: User-modified. (line 88)
+* LINT variable: User-modified. (line 87)
* Linux <1>: Glossary. (line 753)
* Linux <2>: I18N Example. (line 55)
* Linux: Manual History. (line 28)
@@ -33627,7 +33750,7 @@ Index
* mail-list file: Sample Data Files. (line 6)
* mailing labels, printing: Labels Program. (line 6)
* mailing list, GNITS: Acknowledgments. (line 52)
-* Malmberg, John <1>: Bugs. (line 70)
+* Malmberg, John <1>: Bugs. (line 71)
* Malmberg, John: Acknowledgments. (line 60)
* Malmberg, John E.: Contributors. (line 137)
* mark parity: Ordinal Functions. (line 45)
@@ -33655,7 +33778,7 @@ Index
* message object files, converting from portable object files: I18N Example.
(line 64)
* message object files, specifying directory of <1>: Programmer i18n.
- (line 47)
+ (line 48)
* message object files, specifying directory of: Explaining gettext.
(line 54)
* messages from extensions: Printing Messages. (line 6)
@@ -33758,11 +33881,11 @@ Index
* obsolete features: Obsolete. (line 6)
* octal numbers: Nondecimal-numbers. (line 6)
* octal values, enabling interpretation of: Options. (line 211)
-* OFMT variable <1>: User-modified. (line 105)
+* OFMT variable <1>: User-modified. (line 104)
* 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 114)
+* OFS variable <1>: User-modified. (line 113)
* OFS variable <2>: Output Separators. (line 6)
* OFS variable: Changing Fields. (line 64)
* OpenBSD: Glossary. (line 753)
@@ -33815,7 +33938,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 119)
+* ORS variable <1>: User-modified. (line 118)
* ORS variable: Output Separators. (line 21)
* output field separator, See OFS variable: Changing Fields. (line 64)
* output record separator, See ORS variable: Output Separators.
@@ -33866,7 +33989,7 @@ Index
(line 6)
* pipe, input: Getline/Pipe. (line 9)
* pipe, output: Redirection. (line 57)
-* Pitts, Dave <1>: Bugs. (line 70)
+* Pitts, Dave <1>: Bugs. (line 71)
* Pitts, Dave: Acknowledgments. (line 60)
* Plauger, P.J.: Library Functions. (line 12)
* plug-in: Extension Intro. (line 6)
@@ -33955,7 +34078,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 124)
+* PREC variable: User-modified. (line 123)
* precedence <1>: Precedence. (line 6)
* precedence: Increment Ops. (line 60)
* precedence, regexp operators: Regexp Operators. (line 156)
@@ -33970,7 +34093,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 114)
+* print statement, OFMT variable and: User-modified. (line 113)
* print statement, See Also redirection, of output: Redirection.
(line 17)
* print statement, sprintf() function and: Round Function. (line 6)
@@ -34044,7 +34167,7 @@ Index
* pwcat program: Passwd Functions. (line 23)
* q debugger command (alias for quit): Miscellaneous Debugger Commands.
(line 99)
-* QSE Awk: Other Versions. (line 135)
+* QSE awk: Other Versions. (line 135)
* Quanstrom, Erik: Alarm Program. (line 8)
* question mark (?), ?: operator: Precedence. (line 92)
* question mark (?), regexp operator <1>: GNU Regexp Operators.
@@ -34085,7 +34208,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 133)
+* record separators <1>: User-modified. (line 132)
* record separators: awk split records. (line 6)
* record separators, changing: awk split records. (line 85)
* record separators, regular expressions as: awk split records.
@@ -34099,7 +34222,7 @@ Index
* records, terminating: awk split records. (line 125)
* records, treating files as: gawk split records. (line 93)
* recursive functions: Definition Syntax. (line 88)
-* redirect gawk output, in debugger: Debugger Info. (line 72)
+* redirect gawk output, in debugger: Debugger Info. (line 73)
* redirection of input: Getline/File. (line 6)
* redirection of output: Redirection. (line 6)
* reference counting, sorting arrays: Array Sorting Functions.
@@ -34164,7 +34287,7 @@ Index
(line 11)
* revtwoway extension: Extension Sample Rev2way.
(line 12)
-* rewind() user-defined function: Rewind Function. (line 16)
+* rewind() user-defined function: Rewind Function. (line 15)
* right angle bracket (>), > operator <1>: Precedence. (line 65)
* right angle bracket (>), > operator: Comparison Operators.
(line 11)
@@ -34180,7 +34303,7 @@ Index
* RLENGTH variable: Auto-set. (line 279)
* RLENGTH variable, match() function and: String Functions. (line 228)
* Robbins, Arnold <1>: Future Extensions. (line 6)
-* Robbins, Arnold <2>: Bugs. (line 70)
+* Robbins, Arnold <2>: Bugs. (line 71)
* Robbins, Arnold <3>: Contributors. (line 144)
* Robbins, Arnold <4>: General Data Types. (line 6)
* Robbins, Arnold <5>: Alarm Program. (line 6)
@@ -34198,8 +34321,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 128)
-* RS variable <1>: User-modified. (line 133)
+* ROUNDMODE variable: User-modified. (line 127)
+* RS variable <1>: User-modified. (line 132)
* RS variable: awk split records. (line 12)
* RS variable, multiline records and: Multiple Line. (line 17)
* rshift: Bitwise Functions. (line 53)
@@ -34219,7 +34342,7 @@ Index
* sample debugging session: Sample Debugging Session.
(line 6)
* sandbox mode: Options. (line 286)
-* save debugger options: Debugger Info. (line 84)
+* save debugger options: Debugger Info. (line 85)
* scalar or array: Type Functions. (line 11)
* scalar values: Basic Data Typing. (line 13)
* scanning arrays: Scanning an Array. (line 6)
@@ -34256,12 +34379,12 @@ 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 133)
+* separators, for records <1>: User-modified. (line 132)
* 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 146)
+* separators, subscript: User-modified. (line 145)
* set breakpoint: Breakpoint Control. (line 11)
* set debugger command: Viewing And Changing Data.
(line 59)
@@ -34325,7 +34448,7 @@ Index
* sidebar, Recipe for a Programming Language: History. (line 6)
* sidebar, RS = "\0" Is Not Portable: gawk split records. (line 63)
* sidebar, So Why Does gawk Have BEGINFILE and ENDFILE?: Filetrans Function.
- (line 82)
+ (line 83)
* sidebar, Syntactic Ambiguities Between /= and Regular Expressions: Assignment Ops.
(line 146)
* sidebar, Understanding #!: Executable Scripts. (line 31)
@@ -34371,7 +34494,7 @@ Index
(line 94)
* source code, awka: Other Versions. (line 68)
* source code, Brian Kernighan's awk: Other Versions. (line 13)
-* source code, Busybox Awk: Other Versions. (line 92)
+* source code, BusyBox Awk: Other Versions. (line 92)
* source code, gawk: Gawk Distribution. (line 6)
* source code, Illumos awk: Other Versions. (line 109)
* source code, jawk: Other Versions. (line 117)
@@ -34380,7 +34503,7 @@ Index
* source code, mixing: Options. (line 117)
* source code, pawk: Other Versions. (line 82)
* source code, pawk (Python version): Other Versions. (line 129)
-* source code, QSE Awk: Other Versions. (line 135)
+* source code, QSE awk: Other Versions. (line 135)
* 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)
@@ -34393,7 +34516,7 @@ Index
* split.awk program: Split Program. (line 30)
* sprintf <1>: String Functions. (line 384)
* sprintf: OFMT. (line 15)
-* sprintf() function, OFMT variable and: User-modified. (line 114)
+* sprintf() function, OFMT variable and: User-modified. (line 113)
* sprintf() function, print/printf statements and: Round Function.
(line 6)
* sqrt: Numeric Functions. (line 92)
@@ -34441,7 +34564,7 @@ Index
* strings, converting, numbers to: User-modified. (line 30)
* strings, empty, See null strings: awk split records. (line 115)
* strings, extracting: String Extraction. (line 6)
-* strings, for localization: Programmer i18n. (line 14)
+* strings, for localization: Programmer i18n. (line 13)
* strings, length limitations: Scalar Constants. (line 20)
* strings, merging arrays into: Join Function. (line 6)
* strings, null: Regexp Field Splitting.
@@ -34455,7 +34578,7 @@ Index
(line 43)
* sub() function, arguments of: String Functions. (line 463)
* sub() function, escape processing: Gory Details. (line 6)
-* subscript separators: User-modified. (line 146)
+* subscript separators: User-modified. (line 145)
* subscripts in arrays, multidimensional: Multidimensional. (line 10)
* subscripts in arrays, multidimensional, scanning: Multiscanning.
(line 11)
@@ -34463,7 +34586,7 @@ Index
(line 6)
* subscripts in arrays, uninitialized variables as: Uninitialized Subscripts.
(line 6)
-* SUBSEP variable: User-modified. (line 146)
+* SUBSEP variable: User-modified. (line 145)
* SUBSEP variable, and multidimensional arrays: Multidimensional.
(line 16)
* substitute in string: String Functions. (line 90)
@@ -34501,8 +34624,8 @@ Index
(line 6)
* 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 152)
+* TEXTDOMAIN variable <1>: Programmer i18n. (line 8)
+* TEXTDOMAIN variable: User-modified. (line 151)
* 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)
@@ -34529,7 +34652,7 @@ Index
* toupper: String Functions. (line 530)
* tr utility: Translate Program. (line 6)
* trace debugger command: Miscellaneous Debugger Commands.
- (line 108)
+ (line 107)
* traceback, display in debugger: Execution Stack. (line 13)
* translate string: I18N Functions. (line 22)
* translate.awk program: Translate Program. (line 55)
@@ -34709,7 +34832,7 @@ Index
* xor: Bitwise Functions. (line 56)
* XOR bitwise operation: Bitwise Functions. (line 6)
* Yawitz, Efraim: Contributors. (line 131)
-* Zaretskii, Eli <1>: Bugs. (line 70)
+* Zaretskii, Eli <1>: Bugs. (line 71)
* Zaretskii, Eli <2>: Contributors. (line 55)
* Zaretskii, Eli: Acknowledgments. (line 60)
* zerofile.awk program: Empty Files. (line 21)
@@ -34742,562 +34865,563 @@ Index

Tag Table:
Node: Top1204
-Node: Foreword342385
-Node: Foreword446829
-Node: Preface48360
-Ref: Preface-Footnote-151231
-Ref: Preface-Footnote-251338
-Ref: Preface-Footnote-351571
-Node: History51713
-Node: Names54064
-Ref: Names-Footnote-155157
-Node: This Manual55303
-Ref: This Manual-Footnote-161803
-Node: Conventions61903
-Node: Manual History64240
-Ref: Manual History-Footnote-167233
-Ref: Manual History-Footnote-267274
-Node: How To Contribute67348
-Node: Acknowledgments68477
-Node: Getting Started73294
-Node: Running gawk75733
-Node: One-shot76923
-Node: Read Terminal78187
-Node: Long80218
-Node: Executable Scripts81731
-Ref: Executable Scripts-Footnote-184520
-Node: Comments84623
-Node: Quoting87105
-Node: DOS Quoting92623
-Node: Sample Data Files93298
-Node: Very Simple95893
-Node: Two Rules100792
-Node: More Complex102678
-Node: Statements/Lines105540
-Ref: Statements/Lines-Footnote-1109995
-Node: Other Features110260
-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-1575946
-Node: Function Example576017
-Ref: Function Example-Footnote-1578936
-Node: Function Caveats578958
-Node: Calling A Function579476
-Node: Variable Scope580434
-Node: Pass By Value/Reference583422
-Node: Return Statement586917
-Node: Dynamic Typing589898
-Node: Indirect Calls590827
-Ref: Indirect Calls-Footnote-1602129
-Node: Functions Summary602257
-Node: Library Functions604959
-Ref: Library Functions-Footnote-1608568
-Ref: Library Functions-Footnote-2608711
-Node: Library Names608882
-Ref: Library Names-Footnote-1612336
-Ref: Library Names-Footnote-2612559
-Node: General Functions612645
-Node: Strtonum Function613748
-Node: Assert Function616770
-Node: Round Function620094
-Node: Cliff Random Function621635
-Node: Ordinal Functions622651
-Ref: Ordinal Functions-Footnote-1625714
-Ref: Ordinal Functions-Footnote-2625966
-Node: Join Function626177
-Ref: Join Function-Footnote-1627946
-Node: Getlocaltime Function628146
-Node: Readfile Function631890
-Node: Shell Quoting633860
-Node: Data File Management635261
-Node: Filetrans Function635893
-Node: Rewind Function639949
-Node: File Checking641336
-Ref: File Checking-Footnote-1642668
-Node: Empty Files642869
-Node: Ignoring Assigns644848
-Node: Getopt Function646399
-Ref: Getopt Function-Footnote-1657861
-Node: Passwd Functions658061
-Ref: Passwd Functions-Footnote-1666898
-Node: Group Functions666986
-Ref: Group Functions-Footnote-1674880
-Node: Walking Arrays675093
-Node: Library Functions Summary676696
-Node: Library Exercises678097
-Node: Sample Programs679377
-Node: Running Examples680147
-Node: Clones680875
-Node: Cut Program682099
-Node: Egrep Program691818
-Ref: Egrep Program-Footnote-1699316
-Node: Id Program699426
-Node: Split Program703071
-Ref: Split Program-Footnote-1706519
-Node: Tee Program706647
-Node: Uniq Program709436
-Node: Wc Program716855
-Ref: Wc Program-Footnote-1721105
-Node: Miscellaneous Programs721199
-Node: Dupword Program722412
-Node: Alarm Program724443
-Node: Translate Program729247
-Ref: Translate Program-Footnote-1733812
-Node: Labels Program734082
-Ref: Labels Program-Footnote-1737433
-Node: Word Sorting737517
-Node: History Sorting741588
-Node: Extract Program743424
-Node: Simple Sed750949
-Node: Igawk Program754017
-Ref: Igawk Program-Footnote-1768341
-Ref: Igawk Program-Footnote-2768542
-Ref: Igawk Program-Footnote-3768664
-Node: Anagram Program768779
-Node: Signature Program771836
-Node: Programs Summary773083
-Node: Programs Exercises774276
-Ref: Programs Exercises-Footnote-1778407
-Node: Advanced Features778498
-Node: Nondecimal Data780446
-Node: Array Sorting782036
-Node: Controlling Array Traversal782733
-Ref: Controlling Array Traversal-Footnote-1791066
-Node: Array Sorting Functions791184
-Ref: Array Sorting Functions-Footnote-1795073
-Node: Two-way I/O795269
-Ref: Two-way I/O-Footnote-1800214
-Ref: Two-way I/O-Footnote-2800400
-Node: TCP/IP Networking800482
-Node: Profiling803355
-Node: Advanced Features Summary811632
-Node: Internationalization813565
-Node: I18N and L10N815045
-Node: Explaining gettext815731
-Ref: Explaining gettext-Footnote-1820756
-Ref: Explaining gettext-Footnote-2820940
-Node: Programmer i18n821105
-Ref: Programmer i18n-Footnote-1825971
-Node: Translator i18n826020
-Node: String Extraction826814
-Ref: String Extraction-Footnote-1827945
-Node: Printf Ordering828031
-Ref: Printf Ordering-Footnote-1830817
-Node: I18N Portability830881
-Ref: I18N Portability-Footnote-1833336
-Node: I18N Example833399
-Ref: I18N Example-Footnote-1836202
-Node: Gawk I18N836274
-Node: I18N Summary836912
-Node: Debugger838251
-Node: Debugging839273
-Node: Debugging Concepts839714
-Node: Debugging Terms841567
-Node: Awk Debugging844139
-Node: Sample Debugging Session845033
-Node: Debugger Invocation845553
-Node: Finding The Bug846937
-Node: List of Debugger Commands853412
-Node: Breakpoint Control854745
-Node: Debugger Execution Control858441
-Node: Viewing And Changing Data861805
-Node: Execution Stack865183
-Node: Debugger Info866820
-Node: Miscellaneous Debugger Commands870837
-Node: Readline Support875866
-Node: Limitations876758
-Node: Debugging Summary878872
-Node: Arbitrary Precision Arithmetic880040
-Node: Computer Arithmetic881456
-Ref: table-numeric-ranges885054
-Ref: Computer Arithmetic-Footnote-1885913
-Node: Math Definitions885970
-Ref: table-ieee-formats889258
-Ref: Math Definitions-Footnote-1889862
-Node: MPFR features889967
-Node: FP Math Caution891638
-Ref: FP Math Caution-Footnote-1892688
-Node: Inexactness of computations893057
-Node: Inexact representation894016
-Node: Comparing FP Values895373
-Node: Errors accumulate896455
-Node: Getting Accuracy897888
-Node: Try To Round900550
-Node: Setting precision901449
-Ref: table-predefined-precision-strings902133
-Node: Setting the rounding mode903922
-Ref: table-gawk-rounding-modes904286
-Ref: Setting the rounding mode-Footnote-1907741
-Node: Arbitrary Precision Integers907920
-Ref: Arbitrary Precision Integers-Footnote-1912820
-Node: POSIX Floating Point Problems912969
-Ref: POSIX Floating Point Problems-Footnote-1916842
-Node: Floating point summary916880
-Node: Dynamic Extensions919074
-Node: Extension Intro920626
-Node: Plugin License921892
-Node: Extension Mechanism Outline922689
-Ref: figure-load-extension923117
-Ref: figure-register-new-function924597
-Ref: figure-call-new-function925601
-Node: Extension API Description927587
-Node: Extension API Functions Introduction929121
-Node: General Data Types933993
-Ref: General Data Types-Footnote-1939732
-Node: Memory Allocation Functions940031
-Ref: Memory Allocation Functions-Footnote-1942870
-Node: Constructor Functions942966
-Node: Registration Functions944700
-Node: Extension Functions945385
-Node: Exit Callback Functions947682
-Node: Extension Version String948930
-Node: Input Parsers949595
-Node: Output Wrappers959474
-Node: Two-way processors963989
-Node: Printing Messages966193
-Ref: Printing Messages-Footnote-1967269
-Node: Updating `ERRNO'967421
-Node: Requesting Values968161
-Ref: table-value-types-returned968889
-Node: Accessing Parameters969846
-Node: Symbol Table Access971077
-Node: Symbol table by name971591
-Node: Symbol table by cookie973572
-Ref: Symbol table by cookie-Footnote-1977716
-Node: Cached values977779
-Ref: Cached values-Footnote-1981278
-Node: Array Manipulation981369
-Ref: Array Manipulation-Footnote-1982459
-Node: Array Data Types982496
-Ref: Array Data Types-Footnote-1985151
-Node: Array Functions985243
-Node: Flattening Arrays989097
-Node: Creating Arrays995989
-Node: Redirection API1000760
-Node: Extension API Variables1003531
-Node: Extension Versioning1004164
-Node: Extension API Informational Variables1006065
-Node: Extension API Boilerplate1007130
-Node: Finding Extensions1010939
-Node: Extension Example1011499
-Node: Internal File Description1012271
-Node: Internal File Ops1016338
-Ref: Internal File Ops-Footnote-11028008
-Node: Using Internal File Ops1028148
-Ref: Using Internal File Ops-Footnote-11030531
-Node: Extension Samples1030804
-Node: Extension Sample File Functions1032330
-Node: Extension Sample Fnmatch1039968
-Node: Extension Sample Fork1041459
-Node: Extension Sample Inplace1042674
-Node: Extension Sample Ord1044349
-Node: Extension Sample Readdir1045185
-Ref: table-readdir-file-types1046061
-Node: Extension Sample Revout1046872
-Node: Extension Sample Rev2way1047462
-Node: Extension Sample Read write array1048202
-Node: Extension Sample Readfile1050142
-Node: Extension Sample Time1051237
-Node: Extension Sample API Tests1052586
-Node: gawkextlib1053077
-Node: Extension summary1055735
-Node: Extension Exercises1059424
-Node: Language History1060146
-Node: V7/SVR3.11061802
-Node: SVR41063983
-Node: POSIX1065428
-Node: BTL1066817
-Node: POSIX/GNU1067551
-Node: Feature History1073175
-Node: Common Extensions1086273
-Node: Ranges and Locales1087597
-Ref: Ranges and Locales-Footnote-11092215
-Ref: Ranges and Locales-Footnote-21092242
-Ref: Ranges and Locales-Footnote-31092476
-Node: Contributors1092697
-Node: History summary1098238
-Node: Installation1099608
-Node: Gawk Distribution1100554
-Node: Getting1101038
-Node: Extracting1101861
-Node: Distribution contents1103496
-Node: Unix Installation1109561
-Node: Quick Installation1110244
-Node: Shell Startup Files1112655
-Node: Additional Configuration Options1113734
-Node: Configuration Philosophy1115473
-Node: Non-Unix Installation1117842
-Node: PC Installation1118300
-Node: PC Binary Installation1119619
-Node: PC Compiling1121467
-Ref: PC Compiling-Footnote-11124488
-Node: PC Testing1124597
-Node: PC Using1125773
-Node: Cygwin1129888
-Node: MSYS1130711
-Node: VMS Installation1131211
-Node: VMS Compilation1132003
-Ref: VMS Compilation-Footnote-11133225
-Node: VMS Dynamic Extensions1133283
-Node: VMS Installation Details1134967
-Node: VMS Running1137219
-Node: VMS GNV1140055
-Node: VMS Old Gawk1140789
-Node: Bugs1141259
-Node: Other Versions1145142
-Node: Installation summary1151566
-Node: Notes1152622
-Node: Compatibility Mode1153487
-Node: Additions1154269
-Node: Accessing The Source1155194
-Node: Adding Code1156629
-Node: New Ports1162786
-Node: Derived Files1167268
-Ref: Derived Files-Footnote-11172743
-Ref: Derived Files-Footnote-21172777
-Ref: Derived Files-Footnote-31173373
-Node: Future Extensions1173487
-Node: Implementation Limitations1174093
-Node: Extension Design1175341
-Node: Old Extension Problems1176495
-Ref: Old Extension Problems-Footnote-11178012
-Node: Extension New Mechanism Goals1178069
-Ref: Extension New Mechanism Goals-Footnote-11181429
-Node: Extension Other Design Decisions1181618
-Node: Extension Future Growth1183726
-Node: Old Extension Mechanism1184562
-Node: Notes summary1186324
-Node: Basic Concepts1187510
-Node: Basic High Level1188191
-Ref: figure-general-flow1188463
-Ref: figure-process-flow1189062
-Ref: Basic High Level-Footnote-11192291
-Node: Basic Data Typing1192476
-Node: Glossary1195804
-Node: Copying1227733
-Node: GNU Free Documentation License1265289
-Node: Index1290425
+Node: Foreword342451
+Node: Foreword446895
+Node: Preface48426
+Ref: Preface-Footnote-151297
+Ref: Preface-Footnote-251404
+Ref: Preface-Footnote-351637
+Node: History51779
+Node: Names54130
+Ref: Names-Footnote-155224
+Node: This Manual55370
+Ref: This Manual-Footnote-161870
+Node: Conventions61970
+Node: Manual History64307
+Ref: Manual History-Footnote-167300
+Ref: Manual History-Footnote-267341
+Node: How To Contribute67415
+Node: Acknowledgments68544
+Node: Getting Started73410
+Node: Running gawk75849
+Node: One-shot77039
+Node: Read Terminal78303
+Node: Long80334
+Node: Executable Scripts81847
+Ref: Executable Scripts-Footnote-184636
+Node: Comments84739
+Node: Quoting87221
+Node: DOS Quoting92739
+Node: Sample Data Files93414
+Node: Very Simple96009
+Node: Two Rules100908
+Node: More Complex102794
+Node: Statements/Lines105656
+Ref: Statements/Lines-Footnote-1110111
+Node: Other Features110376
+Node: When111312
+Ref: When-Footnote-1113066
+Node: Intro Summary113131
+Node: Invoking Gawk114015
+Node: Command Line115529
+Node: Options116327
+Ref: Options-Footnote-1132122
+Ref: Options-Footnote-2132351
+Node: Other Arguments132376
+Node: Naming Standard Input135324
+Node: Environment Variables136417
+Node: AWKPATH Variable136975
+Ref: AWKPATH Variable-Footnote-1140382
+Ref: AWKPATH Variable-Footnote-2140427
+Node: AWKLIBPATH Variable140687
+Node: Other Environment Variables141943
+Node: Exit Status145574
+Node: Include Files146250
+Node: Loading Shared Libraries149839
+Node: Obsolete151266
+Node: Undocumented151958
+Node: Invoking Summary152225
+Node: Regexp153888
+Node: Regexp Usage155342
+Node: Escape Sequences157379
+Node: Regexp Operators163608
+Ref: Regexp Operators-Footnote-1171018
+Ref: Regexp Operators-Footnote-2171165
+Node: Bracket Expressions171263
+Ref: table-char-classes173278
+Node: Leftmost Longest176220
+Node: Computed Regexps177522
+Node: GNU Regexp Operators180951
+Node: Case-sensitivity184623
+Ref: Case-sensitivity-Footnote-1187508
+Ref: Case-sensitivity-Footnote-2187743
+Node: Regexp Summary187851
+Node: Reading Files189318
+Node: Records191480
+Node: awk split records192213
+Node: gawk split records197142
+Ref: gawk split records-Footnote-1201681
+Node: Fields201718
+Ref: Fields-Footnote-1204496
+Node: Nonconstant Fields204582
+Ref: Nonconstant Fields-Footnote-1206820
+Node: Changing Fields207023
+Node: Field Separators212954
+Node: Default Field Splitting215658
+Node: Regexp Field Splitting216775
+Node: Single Character Fields220125
+Node: Command Line Field Separator221184
+Node: Full Line Fields224401
+Ref: Full Line Fields-Footnote-1225922
+Ref: Full Line Fields-Footnote-2225968
+Node: Field Splitting Summary226069
+Node: Constant Size228143
+Node: Splitting By Content232722
+Ref: Splitting By Content-Footnote-1236687
+Node: Multiple Line236850
+Ref: Multiple Line-Footnote-1242731
+Node: Getline242910
+Node: Plain Getline245389
+Node: Getline/Variable248029
+Node: Getline/File249178
+Node: Getline/Variable/File250563
+Ref: Getline/Variable/File-Footnote-1252166
+Node: Getline/Pipe252253
+Node: Getline/Variable/Pipe254931
+Node: Getline/Coprocess256062
+Node: Getline/Variable/Coprocess257326
+Node: Getline Notes258065
+Node: Getline Summary260859
+Ref: table-getline-variants261271
+Node: Read Timeout262100
+Ref: Read Timeout-Footnote-1266003
+Node: Retrying Input266061
+Node: Command-line directories267256
+Node: Input Summary268163
+Node: Input Exercises271548
+Node: Printing272276
+Node: Print274111
+Node: Print Examples275568
+Node: Output Separators278347
+Node: OFMT280365
+Node: Printf281720
+Node: Basic Printf282505
+Node: Control Letters284077
+Node: Format Modifiers288062
+Node: Printf Examples294068
+Node: Redirection296554
+Node: Special FD303392
+Ref: Special FD-Footnote-1306558
+Node: Special Files306632
+Node: Other Inherited Files307249
+Node: Special Network308249
+Node: Special Caveats309111
+Node: Close Files And Pipes310060
+Ref: Close Files And Pipes-Footnote-1317245
+Ref: Close Files And Pipes-Footnote-2317393
+Node: Nonfatal317543
+Node: Output Summary319868
+Node: Output Exercises321089
+Node: Expressions321769
+Node: Values322958
+Node: Constants323635
+Node: Scalar Constants324326
+Ref: Scalar Constants-Footnote-1325188
+Node: Nondecimal-numbers325438
+Node: Regexp Constants328448
+Node: Using Constant Regexps328974
+Node: Variables332137
+Node: Using Variables332794
+Node: Assignment Options334705
+Node: Conversion336580
+Node: Strings And Numbers337104
+Ref: Strings And Numbers-Footnote-1340169
+Node: Locale influences conversions340278
+Ref: table-locale-affects343024
+Node: All Operators343616
+Node: Arithmetic Ops344245
+Node: Concatenation346750
+Ref: Concatenation-Footnote-1349569
+Node: Assignment Ops349676
+Ref: table-assign-ops354655
+Node: Increment Ops355965
+Node: Truth Values and Conditions359396
+Node: Truth Values360479
+Node: Typing and Comparison361528
+Node: Variable Typing362344
+Node: Comparison Operators366011
+Ref: table-relational-ops366421
+Node: POSIX String Comparison369916
+Ref: POSIX String Comparison-Footnote-1370988
+Node: Boolean Ops371127
+Ref: Boolean Ops-Footnote-1375605
+Node: Conditional Exp375696
+Node: Function Calls377434
+Node: Precedence381314
+Node: Locales384974
+Node: Expressions Summary386606
+Node: Patterns and Actions389177
+Node: Pattern Overview390297
+Node: Regexp Patterns391976
+Node: Expression Patterns392519
+Node: Ranges396299
+Node: BEGIN/END399406
+Node: Using BEGIN/END400167
+Ref: Using BEGIN/END-Footnote-1402903
+Node: I/O And BEGIN/END403009
+Node: BEGINFILE/ENDFILE405324
+Node: Empty408221
+Node: Using Shell Variables408538
+Node: Action Overview410811
+Node: Statements413137
+Node: If Statement414985
+Node: While Statement416480
+Node: Do Statement418508
+Node: For Statement419656
+Node: Switch Statement422814
+Node: Break Statement425196
+Node: Continue Statement427289
+Node: Next Statement429116
+Node: Nextfile Statement431497
+Node: Exit Statement434125
+Node: Built-in Variables436536
+Node: User-modified437669
+Ref: User-modified-Footnote-1445303
+Node: Auto-set445365
+Ref: Auto-set-Footnote-1459598
+Ref: Auto-set-Footnote-2459803
+Node: ARGC and ARGV459859
+Node: Pattern Action Summary464077
+Node: Arrays466510
+Node: Array Basics467839
+Node: Array Intro468683
+Ref: figure-array-elements470620
+Ref: Array Intro-Footnote-1473243
+Node: Reference to Elements473371
+Node: Assigning Elements475833
+Node: Array Example476324
+Node: Scanning an Array478083
+Node: Controlling Scanning481106
+Ref: Controlling Scanning-Footnote-1486500
+Node: Numeric Array Subscripts486816
+Node: Uninitialized Subscripts489001
+Node: Delete490618
+Ref: Delete-Footnote-1493367
+Node: Multidimensional493424
+Node: Multiscanning496521
+Node: Arrays of Arrays498110
+Node: Arrays Summary502864
+Node: Functions504955
+Node: Built-in505994
+Node: Calling Built-in507072
+Node: Numeric Functions509067
+Ref: Numeric Functions-Footnote-1513885
+Ref: Numeric Functions-Footnote-2514242
+Ref: Numeric Functions-Footnote-3514290
+Node: String Functions514562
+Ref: String Functions-Footnote-1538063
+Ref: String Functions-Footnote-2538192
+Ref: String Functions-Footnote-3538440
+Node: Gory Details538527
+Ref: table-sub-escapes540308
+Ref: table-sub-proposed541823
+Ref: table-posix-sub543185
+Ref: table-gensub-escapes544722
+Ref: Gory Details-Footnote-1545555
+Node: I/O Functions545706
+Ref: I/O Functions-Footnote-1552942
+Node: Time Functions553089
+Ref: Time Functions-Footnote-1563598
+Ref: Time Functions-Footnote-2563666
+Ref: Time Functions-Footnote-3563824
+Ref: Time Functions-Footnote-4563935
+Ref: Time Functions-Footnote-5564047
+Ref: Time Functions-Footnote-6564274
+Node: Bitwise Functions564540
+Ref: table-bitwise-ops565102
+Ref: Bitwise Functions-Footnote-1569430
+Node: Type Functions569602
+Node: I18N Functions570754
+Node: User-defined572401
+Node: Definition Syntax573206
+Ref: Definition Syntax-Footnote-1578865
+Node: Function Example578936
+Ref: Function Example-Footnote-1581857
+Node: Function Caveats581879
+Node: Calling A Function582397
+Node: Variable Scope583355
+Node: Pass By Value/Reference586348
+Node: Return Statement589845
+Node: Dynamic Typing592824
+Node: Indirect Calls593753
+Ref: Indirect Calls-Footnote-1603618
+Node: Functions Summary603746
+Node: Library Functions606448
+Ref: Library Functions-Footnote-1610056
+Ref: Library Functions-Footnote-2610199
+Node: Library Names610370
+Ref: Library Names-Footnote-1613828
+Ref: Library Names-Footnote-2614051
+Node: General Functions614137
+Node: Strtonum Function615240
+Node: Assert Function618262
+Node: Round Function621586
+Node: Cliff Random Function623127
+Node: Ordinal Functions624143
+Ref: Ordinal Functions-Footnote-1627206
+Ref: Ordinal Functions-Footnote-2627458
+Node: Join Function627669
+Ref: Join Function-Footnote-1629439
+Node: Getlocaltime Function629639
+Node: Readfile Function633383
+Node: Shell Quoting635355
+Node: Data File Management636756
+Node: Filetrans Function637388
+Node: Rewind Function641484
+Node: File Checking642870
+Ref: File Checking-Footnote-1644203
+Node: Empty Files644404
+Node: Ignoring Assigns646383
+Node: Getopt Function647933
+Ref: Getopt Function-Footnote-1659397
+Node: Passwd Functions659597
+Ref: Passwd Functions-Footnote-1668437
+Node: Group Functions668525
+Ref: Group Functions-Footnote-1676422
+Node: Walking Arrays676627
+Node: Library Functions Summary679633
+Node: Library Exercises681035
+Node: Sample Programs682315
+Node: Running Examples683085
+Node: Clones683813
+Node: Cut Program685037
+Node: Egrep Program694757
+Ref: Egrep Program-Footnote-1702260
+Node: Id Program702370
+Node: Split Program706046
+Ref: Split Program-Footnote-1709500
+Node: Tee Program709628
+Node: Uniq Program712417
+Node: Wc Program719836
+Ref: Wc Program-Footnote-1724086
+Node: Miscellaneous Programs724180
+Node: Dupword Program725393
+Node: Alarm Program727424
+Node: Translate Program732229
+Ref: Translate Program-Footnote-1736792
+Node: Labels Program737062
+Ref: Labels Program-Footnote-1740413
+Node: Word Sorting740497
+Node: History Sorting744567
+Node: Extract Program746402
+Node: Simple Sed753926
+Node: Igawk Program756996
+Ref: Igawk Program-Footnote-1771322
+Ref: Igawk Program-Footnote-2771523
+Ref: Igawk Program-Footnote-3771645
+Node: Anagram Program771760
+Node: Signature Program774821
+Node: Programs Summary776068
+Node: Programs Exercises777289
+Ref: Programs Exercises-Footnote-1781420
+Node: Advanced Features781511
+Node: Nondecimal Data783493
+Node: Array Sorting785083
+Node: Controlling Array Traversal785783
+Ref: Controlling Array Traversal-Footnote-1794149
+Node: Array Sorting Functions794267
+Ref: Array Sorting Functions-Footnote-1798153
+Node: Two-way I/O798349
+Ref: Two-way I/O-Footnote-1803294
+Ref: Two-way I/O-Footnote-2803480
+Node: TCP/IP Networking803562
+Node: Profiling806434
+Node: Advanced Features Summary814705
+Node: Internationalization816638
+Node: I18N and L10N818118
+Node: Explaining gettext818804
+Ref: Explaining gettext-Footnote-1823829
+Ref: Explaining gettext-Footnote-2824013
+Node: Programmer i18n824178
+Ref: Programmer i18n-Footnote-1829054
+Node: Translator i18n829103
+Node: String Extraction829897
+Ref: String Extraction-Footnote-1831028
+Node: Printf Ordering831114
+Ref: Printf Ordering-Footnote-1833900
+Node: I18N Portability833964
+Ref: I18N Portability-Footnote-1836420
+Node: I18N Example836483
+Ref: I18N Example-Footnote-1839286
+Node: Gawk I18N839358
+Node: I18N Summary840002
+Node: Debugger841342
+Node: Debugging842364
+Node: Debugging Concepts842805
+Node: Debugging Terms844615
+Node: Awk Debugging847187
+Node: Sample Debugging Session848093
+Node: Debugger Invocation848627
+Node: Finding The Bug850012
+Node: List of Debugger Commands856491
+Node: Breakpoint Control857823
+Node: Debugger Execution Control861500
+Node: Viewing And Changing Data864859
+Node: Execution Stack868235
+Node: Debugger Info869870
+Node: Miscellaneous Debugger Commands873915
+Node: Readline Support878916
+Node: Limitations879810
+Node: Debugging Summary881925
+Node: Arbitrary Precision Arithmetic883099
+Node: Computer Arithmetic884515
+Ref: table-numeric-ranges888092
+Ref: Computer Arithmetic-Footnote-1888616
+Node: Math Definitions888673
+Ref: table-ieee-formats891968
+Ref: Math Definitions-Footnote-1892572
+Node: MPFR features892677
+Node: FP Math Caution894348
+Ref: FP Math Caution-Footnote-1895398
+Node: Inexactness of computations895767
+Node: Inexact representation896726
+Node: Comparing FP Values898084
+Node: Errors accumulate899166
+Node: Getting Accuracy900598
+Node: Try To Round903302
+Node: Setting precision904201
+Ref: table-predefined-precision-strings904885
+Node: Setting the rounding mode906714
+Ref: table-gawk-rounding-modes907078
+Ref: Setting the rounding mode-Footnote-1910530
+Node: Arbitrary Precision Integers910709
+Ref: Arbitrary Precision Integers-Footnote-1915607
+Node: POSIX Floating Point Problems915756
+Ref: POSIX Floating Point Problems-Footnote-1919635
+Node: Floating point summary919673
+Node: Dynamic Extensions921860
+Node: Extension Intro923412
+Node: Plugin License924677
+Node: Extension Mechanism Outline925474
+Ref: figure-load-extension925902
+Ref: figure-register-new-function927382
+Ref: figure-call-new-function928386
+Node: Extension API Description930373
+Node: Extension API Functions Introduction931907
+Node: General Data Types936776
+Ref: General Data Types-Footnote-1942676
+Node: Memory Allocation Functions942975
+Ref: Memory Allocation Functions-Footnote-1945814
+Node: Constructor Functions945913
+Node: Registration Functions947652
+Node: Extension Functions948337
+Node: Exit Callback Functions950634
+Node: Extension Version String951882
+Node: Input Parsers952545
+Node: Output Wrappers962420
+Node: Two-way processors966933
+Node: Printing Messages969196
+Ref: Printing Messages-Footnote-1970272
+Node: Updating `ERRNO'970424
+Node: Requesting Values971164
+Ref: table-value-types-returned971891
+Node: Accessing Parameters972848
+Node: Symbol Table Access974082
+Node: Symbol table by name974596
+Node: Symbol table by cookie976616
+Ref: Symbol table by cookie-Footnote-1980761
+Node: Cached values980824
+Ref: Cached values-Footnote-1984320
+Node: Array Manipulation984411
+Ref: Array Manipulation-Footnote-1985501
+Node: Array Data Types985538
+Ref: Array Data Types-Footnote-1988193
+Node: Array Functions988285
+Node: Flattening Arrays992144
+Node: Creating Arrays999046
+Node: Redirection API1003817
+Node: Extension API Variables1006588
+Node: Extension Versioning1007221
+Node: Extension API Informational Variables1009112
+Node: Extension API Boilerplate1010177
+Node: Finding Extensions1013986
+Node: Extension Example1014546
+Node: Internal File Description1015318
+Node: Internal File Ops1019385
+Ref: Internal File Ops-Footnote-11031136
+Node: Using Internal File Ops1031276
+Ref: Using Internal File Ops-Footnote-11033659
+Node: Extension Samples1033932
+Node: Extension Sample File Functions1035460
+Node: Extension Sample Fnmatch1043141
+Node: Extension Sample Fork1044629
+Node: Extension Sample Inplace1045844
+Node: Extension Sample Ord1047930
+Node: Extension Sample Readdir1048766
+Ref: table-readdir-file-types1049643
+Node: Extension Sample Revout1050454
+Node: Extension Sample Rev2way1051043
+Node: Extension Sample Read write array1051783
+Node: Extension Sample Readfile1053723
+Node: Extension Sample Time1054818
+Node: Extension Sample API Tests1056166
+Node: gawkextlib1056657
+Node: Extension summary1059335
+Node: Extension Exercises1063024
+Node: Language History1063746
+Node: V7/SVR3.11065402
+Node: SVR41067555
+Node: POSIX1068989
+Node: BTL1070370
+Node: POSIX/GNU1071101
+Node: Feature History1076937
+Node: Common Extensions1090731
+Node: Ranges and Locales1092103
+Ref: Ranges and Locales-Footnote-11096722
+Ref: Ranges and Locales-Footnote-21096749
+Ref: Ranges and Locales-Footnote-31096984
+Node: Contributors1097205
+Node: History summary1102745
+Node: Installation1104124
+Node: Gawk Distribution1105070
+Node: Getting1105554
+Node: Extracting1106377
+Node: Distribution contents1108014
+Node: Unix Installation1114116
+Node: Quick Installation1114799
+Node: Shell Startup Files1117210
+Node: Additional Configuration Options1118289
+Node: Configuration Philosophy1120093
+Node: Non-Unix Installation1122462
+Node: PC Installation1122920
+Node: PC Binary Installation1124240
+Node: PC Compiling1126088
+Ref: PC Compiling-Footnote-11129109
+Node: PC Testing1129218
+Node: PC Using1130394
+Node: Cygwin1134509
+Node: MSYS1135279
+Node: VMS Installation1135780
+Node: VMS Compilation1136572
+Ref: VMS Compilation-Footnote-11137801
+Node: VMS Dynamic Extensions1137859
+Node: VMS Installation Details1139543
+Node: VMS Running1141794
+Node: VMS GNV1144634
+Node: VMS Old Gawk1145369
+Node: Bugs1145839
+Node: Other Versions1149728
+Node: Installation summary1156162
+Node: Notes1157221
+Node: Compatibility Mode1158086
+Node: Additions1158868
+Node: Accessing The Source1159793
+Node: Adding Code1161228
+Node: New Ports1167385
+Node: Derived Files1171867
+Ref: Derived Files-Footnote-11177342
+Ref: Derived Files-Footnote-21177376
+Ref: Derived Files-Footnote-31177972
+Node: Future Extensions1178086
+Node: Implementation Limitations1178692
+Node: Extension Design1179940
+Node: Old Extension Problems1181094
+Ref: Old Extension Problems-Footnote-11182611
+Node: Extension New Mechanism Goals1182668
+Ref: Extension New Mechanism Goals-Footnote-11186028
+Node: Extension Other Design Decisions1186217
+Node: Extension Future Growth1188325
+Node: Old Extension Mechanism1189161
+Node: Notes summary1190923
+Node: Basic Concepts1192109
+Node: Basic High Level1192790
+Ref: figure-general-flow1193062
+Ref: figure-process-flow1193661
+Ref: Basic High Level-Footnote-11196890
+Node: Basic Data Typing1197075
+Node: Glossary1200403
+Node: Copying1232332
+Node: GNU Free Documentation License1269888
+Node: Index1295024

End Tag Table