[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, feature/better-index, created. gawk-4.1.
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, feature/better-index, created. gawk-4.1.0-3706-g5a52833 |
Date: |
Wed, 10 Apr 2019 15:07:13 -0400 (EDT) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, feature/better-index has been created
at 5a52833a68f511e77ee5120d7142124c53740b68 (commit)
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=5a52833a68f511e77ee5120d7142124c53740b68
commit 5a52833a68f511e77ee5120d7142124c53740b68
Merge: 37d907a 8339e74
Author: Arnold D. Robbins <address@hidden>
Date: Wed Apr 10 22:06:58 2019 +0300
Merge branch 'master' into feature/better-index
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=37d907a755994e20ca891731a13179f76eac8332
commit 37d907a755994e20ca891731a13179f76eac8332
Author: Arnold D. Robbins <address@hidden>
Date: Mon Apr 8 21:42:47 2019 +0300
Next indexing fix.
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 881b866..60d97b6 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -1315,6 +1315,7 @@ October 2014
</prefaceinfo>
@end docbook
address@hidden @command{awk}
Several kinds of tasks occur repeatedly when working with text files.
You might want to extract certain lines and discard the rest. Or you
may need to make changes wherever certain patterns appear, but leave the
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 5b5c652..42a518d 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -1310,6 +1310,7 @@ October 2014
</prefaceinfo>
@end docbook
address@hidden @command{awk}
Several kinds of tasks occur repeatedly when working with text files.
You might want to extract certain lines and discard the rest. Or you
may need to make changes wherever certain patterns appear, but leave the
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=2cdadd3091075ffcdf4c8e3c4395b8059fc76033
commit 2cdadd3091075ffcdf4c8e3c4395b8059fc76033
Author: Arnold D. Robbins <address@hidden>
Date: Sun Apr 7 22:01:12 2019 +0300
More indexing updates.
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 113cafb..881b866 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -4298,6 +4298,12 @@ with respect to whatever the Free Software Foundation is
currently
distributing.
It is also useful for bug reports
(@pxref{Bugs}).
+
address@hidden @code{-} (hyphen) @subentry @code{--} end of options marker
address@hidden @code{--}
+Mark the end of all options.
+Any command-line arguments following @code{--} are placed in @code{ARGV},
+even if they start with a minus sign.
@end table
As long as program text has been supplied,
@@ -4753,7 +4759,7 @@ to @code{EXIT_FAILURE}.
This @value{SECTION} describes a feature that is specific to @command{gawk}.
address@hidden @code{@@include} directive
address@hidden @code{@@} (at-sign) @subentry @code{@@include} directive
@cindex file inclusion, @code{@@include} directive
@cindex including files, @code{@@include} directive
The @code{@@include} keyword can be used to read external @command{awk} source
@@ -4881,7 +4887,7 @@ at their beginning. @xref{Changing The Namespace}, for
more information.
This @value{SECTION} describes a feature that is specific to @command{gawk}.
address@hidden @code{@@load} directive
address@hidden @code{@@} (at-sign) @subentry @code{@@load} directive
@cindex loading extensions, @code{@@load} directive
@cindex extensions @subentry loading @subentry @code{@@load} directive
The @code{@@load} keyword can be used to read external @command{awk} extensions
@@ -16815,7 +16821,7 @@ assign to that element of the array.
@node Array Example
@subsection Basic Array Example
address@hidden arrays @subentry an example of using
address@hidden arrays @subentry example of using
The following program takes a list of lines, each beginning with a line
number, and prints them out in order of line number. The line numbers
@@ -17241,7 +17247,7 @@ effect on your programs.
@cindex variables @subentry uninitialized, as array subscripts
@cindex uninitialized variables, as array subscripts
@cindex subscripts in arrays @subentry uninitialized variables as
address@hidden arrays @subentry subscripts @subentry uninitialized variables as
address@hidden arrays @subentry subscripts, uninitialized variables as
Suppose it's necessary to write a program
to print the input data in reverse order.
A reasonable attempt to do so (with some test
@@ -17285,7 +17291,7 @@ Here, the @samp{++} forces @code{lines} to be numeric,
thus making
the ``old value'' numeric zero. This is then converted to @code{"0"}
as the array subscript.
address@hidden array subscripts @subentry null strings as
address@hidden array subscripts @subentry null string as
@cindex null strings @subentry as array subscripts
@cindex dark corner @subentry array subscripts
@cindex lint checking @subentry array subscripts
@@ -21330,7 +21336,7 @@ This style of programming works, but can be awkward.
With @dfn{indirect}
function calls, you tell @command{gawk} to use the @emph{value} of a
variable as the @emph{name} of the function to call.
address@hidden @code{@@}-notation for indirect function calls
address@hidden @code{@@} (at-sign) @subentry @code{@@}-notation for indirect
function calls
@cindex indirect function calls, @code{@@}-notation
@cindex function calls @subentry indirect @subentry @code{@@}-notation for
The syntax is similar to that of a regular function call: an identifier
@@ -28515,9 +28521,9 @@ sorted array traversal is not the default.
@cindex arrays @subentry sorting
@cindexgawkfunc{asort}
address@hidden @code{asort()} function (@command{gawk}), address@hidden sorting
address@hidden @code{asort()} function (@command{gawk}) @subentry arrays,
sorting
@cindexgawkfunc{asorti}
address@hidden @code{asorti()} function (@command{gawk}), address@hidden sorting
address@hidden @code{asorti()} function (@command{gawk}) @subentry arrays,
sorting
@cindex sort function, arrays, sorting
In most @command{awk} implementations, sorting an array requires writing
a @code{sort()} function. This can be educational for exploring
@@ -31228,7 +31234,7 @@ No newline is printed unless one is specified.
@cindex debugger commands @subentry @code{set}
@cindex @code{set} debugger command
address@hidden assign values to variables @subentry in debugger
address@hidden assign values to variables, in debugger
@item @code{set} @address@hidden@var{value}
Assign a constant (number or string) value to an @command{awk} variable
or field.
@@ -31922,7 +31928,7 @@ It also keeps your code looking natural.
@section Changing The Namespace
@cindex namespaces @subentry changing
address@hidden @code{@@namespace} directive
address@hidden @code{@@} (at-sign) @subentry @code{@@namespace} directive
In order to set the current namespace, use an @code{@@namespace} directive
at the top level of your program:
@@ -31964,7 +31970,7 @@ directive is seen. When @command{gawk} finishes
processing the included
file, the saved namespace is restored and processing continues where it
left off in the original file.
address@hidden @code{@@namespace}, no effect on @address@hidden @address@hidden
@address@hidden and @code{ENDFILE}
address@hidden @code{@@} (at-sign) @subentry @code{@@namespace}, no effect on
@address@hidden @address@hidden @address@hidden and @code{ENDFILE}
@cindex @code{BEGIN} pattern @subentry execution order not affected by
@code{@@namespace}
@cindex @code{BEGINFILE} pattern @subentry execution order not affected by
@code{@@namespace}
@cindex @code{END} pattern @subentry execution order not affected by
@code{@@namespace}
@@ -41973,11 +41979,7 @@ A number of the files that come with @command{gawk}
are maintained by other
people. Thus, you should not change them
unless it is for a very good reason; i.e., changes are not out of the
question, but changes to these files are scrutinized extra carefully.
-<<<<<<< HEAD
-These are all the files the @file{support} directory
-=======
These are all the files in the @file{support} directory
->>>>>>> master
within the @command{gawk} distribution. See there.
@item
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 316be9c..5b5c652 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -4208,6 +4208,12 @@ with respect to whatever the Free Software Foundation is
currently
distributing.
It is also useful for bug reports
(@pxref{Bugs}).
+
address@hidden @code{-} (hyphen) @subentry @code{--} end of options marker
address@hidden @code{--}
+Mark the end of all options.
+Any command-line arguments following @code{--} are placed in @code{ARGV},
+even if they start with a minus sign.
@end table
As long as program text has been supplied,
@@ -4663,7 +4669,7 @@ to @code{EXIT_FAILURE}.
This @value{SECTION} describes a feature that is specific to @command{gawk}.
address@hidden @code{@@include} directive
address@hidden @code{@@} (at-sign) @subentry @code{@@include} directive
@cindex file inclusion, @code{@@include} directive
@cindex including files, @code{@@include} directive
The @code{@@include} keyword can be used to read external @command{awk} source
@@ -4791,7 +4797,7 @@ at their beginning. @xref{Changing The Namespace}, for
more information.
This @value{SECTION} describes a feature that is specific to @command{gawk}.
address@hidden @code{@@load} directive
address@hidden @code{@@} (at-sign) @subentry @code{@@load} directive
@cindex loading extensions, @code{@@load} directive
@cindex extensions @subentry loading @subentry @code{@@load} directive
The @code{@@load} keyword can be used to read external @command{awk} extensions
@@ -16086,7 +16092,7 @@ assign to that element of the array.
@node Array Example
@subsection Basic Array Example
address@hidden arrays @subentry an example of using
address@hidden arrays @subentry example of using
The following program takes a list of lines, each beginning with a line
number, and prints them out in order of line number. The line numbers
@@ -16512,7 +16518,7 @@ effect on your programs.
@cindex variables @subentry uninitialized, as array subscripts
@cindex uninitialized variables, as array subscripts
@cindex subscripts in arrays @subentry uninitialized variables as
address@hidden arrays @subentry subscripts @subentry uninitialized variables as
address@hidden arrays @subentry subscripts, uninitialized variables as
Suppose it's necessary to write a program
to print the input data in reverse order.
A reasonable attempt to do so (with some test
@@ -16556,7 +16562,7 @@ Here, the @samp{++} forces @code{lines} to be numeric,
thus making
the ``old value'' numeric zero. This is then converted to @code{"0"}
as the array subscript.
address@hidden array subscripts @subentry null strings as
address@hidden array subscripts @subentry null string as
@cindex null strings @subentry as array subscripts
@cindex dark corner @subentry array subscripts
@cindex lint checking @subentry array subscripts
@@ -20372,7 +20378,7 @@ This style of programming works, but can be awkward.
With @dfn{indirect}
function calls, you tell @command{gawk} to use the @emph{value} of a
variable as the @emph{name} of the function to call.
address@hidden @code{@@}-notation for indirect function calls
address@hidden @code{@@} (at-sign) @subentry @code{@@}-notation for indirect
function calls
@cindex indirect function calls, @code{@@}-notation
@cindex function calls @subentry indirect @subentry @code{@@}-notation for
The syntax is similar to that of a regular function call: an identifier
@@ -27527,9 +27533,9 @@ sorted array traversal is not the default.
@cindex arrays @subentry sorting
@cindexgawkfunc{asort}
address@hidden @code{asort()} function (@command{gawk}), address@hidden sorting
address@hidden @code{asort()} function (@command{gawk}) @subentry arrays,
sorting
@cindexgawkfunc{asorti}
address@hidden @code{asorti()} function (@command{gawk}), address@hidden sorting
address@hidden @code{asorti()} function (@command{gawk}) @subentry arrays,
sorting
@cindex sort function, arrays, sorting
In most @command{awk} implementations, sorting an array requires writing
a @code{sort()} function. This can be educational for exploring
@@ -30240,7 +30246,7 @@ No newline is printed unless one is specified.
@cindex debugger commands @subentry @code{set}
@cindex @code{set} debugger command
address@hidden assign values to variables @subentry in debugger
address@hidden assign values to variables, in debugger
@item @code{set} @address@hidden@var{value}
Assign a constant (number or string) value to an @command{awk} variable
or field.
@@ -30934,7 +30940,7 @@ It also keeps your code looking natural.
@section Changing The Namespace
@cindex namespaces @subentry changing
address@hidden @code{@@namespace} directive
address@hidden @code{@@} (at-sign) @subentry @code{@@namespace} directive
In order to set the current namespace, use an @code{@@namespace} directive
at the top level of your program:
@@ -30976,7 +30982,7 @@ directive is seen. When @command{gawk} finishes
processing the included
file, the saved namespace is restored and processing continues where it
left off in the original file.
address@hidden @code{@@namespace}, no effect on @address@hidden @address@hidden
@address@hidden and @code{ENDFILE}
address@hidden @code{@@} (at-sign) @subentry @code{@@namespace}, no effect on
@address@hidden @address@hidden @address@hidden and @code{ENDFILE}
@cindex @code{BEGIN} pattern @subentry execution order not affected by
@code{@@namespace}
@cindex @code{BEGINFILE} pattern @subentry execution order not affected by
@code{@@namespace}
@cindex @code{END} pattern @subentry execution order not affected by
@code{@@namespace}
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=2eea174133723a30a3b347bdbc93d05ac3203623
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=01af55a27d0bafc4d9072ffb7b038bf8c82fe985
commit 01af55a27d0bafc4d9072ffb7b038bf8c82fe985
Author: Arnold D. Robbins <address@hidden>
Date: Fri Apr 5 10:22:50 2019 +0300
Fix sidebar.awk to use @subentry.
diff --git a/doc/gawk.texi b/doc/gawk.texi
index f3d5dc2..ba7aa85 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -1335,12 +1335,12 @@ properly written @command{awk} programs should work
with @command{gawk}.
So most of the time, we don't distinguish between @command{gawk} and other
@command{awk} implementations.
address@hidden @command{awk}, POSIX and, See Also POSIX @command{awk}
address@hidden @command{awk}, POSIX and
address@hidden POSIX, @command{awk} and
address@hidden @command{gawk}, @command{awk} and
address@hidden @command{awk}, @command{gawk} and
address@hidden @command{awk}, uses for
address@hidden @command{awk} @subentry POSIX and @seealso{POSIX @command{awk}}
address@hidden @command{awk} @subentry POSIX and
address@hidden POSIX @subentry @command{awk} and
address@hidden @command{gawk} @subentry @command{awk} and
address@hidden @command{awk} @subentry @command{gawk} and
address@hidden @command{awk} @subentry uses for
Using @command{awk} you can:
@itemize @value{BULLET}
@@ -1361,9 +1361,9 @@ Experiment with algorithms that you can adapt later to
other computer
languages
@end itemize
address@hidden @command{awk}, See Also @command{gawk}
address@hidden @command{gawk}, See Also @command{awk}
address@hidden @command{gawk}, uses for
address@hidden @command{awk} @address@hidden
address@hidden @command{gawk} @address@hidden
address@hidden @command{gawk} @subentry uses for
In addition,
@command{gawk}
provides facilities that make it easy to:
@@ -1393,7 +1393,7 @@ Unix-based systems. If you are using some other operating
system, you still need
be familiar with the ideas of I/O redirection and pipes.} as well as basic
shell
facilities, such as input/output (I/O) redirection and pipes.
address@hidden GNU @command{awk}, See @command{gawk}
address@hidden GNU @command{awk} @address@hidden
Implementations of the @command{awk} language are available for many
different computing environments. This @value{DOCUMENT}, while describing
the @command{awk} language in general, also describes the particular
@@ -1425,7 +1425,7 @@ has been removed.}
@unnumberedsec History of @command{awk} and @command{gawk}
@cindex recipe for a programming language
@cindex programming language, recipe for
address@hidden sidebar, Recipe for a Programming Language
address@hidden sidebar @subentry Recipe for a Programming Language
@ifdocbook
@docbook
<sidebar><title>Recipe for a Programming Language</title>
@@ -1470,7 +1470,7 @@ more parts C. Document very well and release.
@cindex Aho, Alfred
@cindex Weinberger, Peter
@cindex Kernighan, Brian
address@hidden @command{awk}, history of
address@hidden @command{awk} @subentry history of
The name @command{awk} comes from the initials of its designers: Alfred V.@:
Aho, Peter J.@: Weinberger, and Brian W.@: Kernighan. The original version of
@command{awk} was written in 1977 at AT&T Bell Laboratories.
@@ -1517,7 +1517,7 @@ for a full list of those who have made important
contributions to @command{gawk}
@node Names
@unnumberedsec A Rose by Any Other Name
address@hidden @command{awk}, new vs.@: old
address@hidden @command{awk} @subentry new vs.@: old
The @command{awk} language has evolved over the years. Full details are
provided in @ref{Language History}.
The language described in this @value{DOCUMENT}
@@ -1552,7 +1552,7 @@ specific to the GNU implementation, we use the term
@command{gawk}.
@node This Manual
@unnumberedsec Using This Book
address@hidden @command{awk}, terms describing
address@hidden @command{awk} @subentry terms describing
The term @command{awk} refers to a particular program as well as to the
language you
use to tell this program what to do. When we need to be careful, we call
@@ -1564,8 +1564,8 @@ run the @command{awk} utility.
The term address@hidden program'' refers to a program written by you in
the @command{awk} programming language.
address@hidden @command{gawk}, @command{awk} and
address@hidden @command{awk}, @command{gawk} and
address@hidden @command{gawk} @subentry @command{awk} and
address@hidden @command{awk} @subentry @command{gawk} and
@cindex POSIX @command{awk}
Primarily, this @value{DOCUMENT} explains the features of @command{awk}
as defined in the POSIX standard. It does so in the context of the
@@ -1924,7 +1924,7 @@ you illuminate, there's always a smaller but darker one.}
@author Brian Kernighan
@end quotation
address@hidden d.c., See dark corner
address@hidden d.c. @seeentry{dark corner}
@cindex dark corner
Until the POSIX standard (and @address@hidden),
many features of @command{awk} were either poorly documented or not
@@ -1944,7 +1944,7 @@ They also appear in the index under the heading ``dark
corner.''
But, as noted by the opening quote, any coverage of dark
corners is by definition incomplete.
address@hidden c.e., See common extensions
address@hidden c.e. @seeentry{common extensions}
Extensions to the standard @command{awk} language that are supported by
more than one @command{awk} implementation are marked
@ifclear FOR_PRINT
@@ -1968,8 +1968,8 @@ Emacs editor. GNU Emacs is the most widely used version
of Emacs today.
@cindex GNU Project
@cindex GPL (General Public License)
address@hidden General Public License, See GPL
address@hidden documentation, online
address@hidden General Public License @seeentry{GPL}
address@hidden documentation @subentry online
The address@hidden stands for ``GNU's Not Unix.''}
Project is an ongoing effort on the part of the Free Software
Foundation to create a complete, freely distributable, POSIX-compliant
@@ -2001,7 +2001,7 @@ stage of development.
@cindex Linux
@cindex GNU/Linux
address@hidden operating systems, BSD-based
address@hidden operating systems @subentry BSD-based
Until the GNU operating system is more fully developed, you should
consider using GNU/Linux, a freely distributable, Unix-like operating
system for Intel,
@@ -2351,7 +2351,7 @@ following chapters:
@c @cindex rule, definition of
@c @cindex program, definition of
@c @cindex basic function of @command{awk}
address@hidden @command{awk}, function of
address@hidden @command{awk} @subentry function of
The basic function of @command{awk} is to search files for lines (or other
units of text) that contain certain patterns. When a line matches one
@@ -2359,7 +2359,7 @@ of the patterns, @command{awk} performs specified actions
on that line.
@command{awk} continues to process input lines in this way until it reaches
the end of the input files.
address@hidden @command{awk}, uses for
address@hidden @command{awk} @subentry uses for
@cindex programming address@hidden data-driven vs.@: procedural
@cindex @command{awk} programs
Programs in @command{awk} are different from programs in most other languages,
@@ -2413,7 +2413,7 @@ program looks like this:
@node Running gawk
@section How to Run @command{awk} Programs
address@hidden @command{awk} programs, running
address@hidden @command{awk} programs @subentry running
There are several ways to run an @command{awk} program. If the program is
short, it is easiest to include it in the command that runs @command{awk},
like this:
@@ -2422,7 +2422,7 @@ like this:
awk '@var{program}' @var{input-file1} @var{input-file2} @dots{}
@end example
address@hidden command line, formats
address@hidden command line @subentry formats
When the program is long, it is usually more convenient to put it in a file
and run it with a command like this:
@@ -2471,8 +2471,8 @@ characters. The quotes also cause the shell to treat all
of @var{program} as
a single argument for @command{awk}, and allow @var{program} to be more
than one line long.
address@hidden shells, scripts
address@hidden @command{awk} programs, running, from shell scripts
address@hidden shells @subentry scripts
address@hidden @command{awk} programs @subentry running @subentry from shell
scripts
This format is also useful for running short or medium-sized @command{awk}
programs from shell scripts, because it avoids the need for a separate
file for the @command{awk} program. A self-contained shell script is more
@@ -2490,8 +2490,8 @@ self-contained programs.
@subsection Running @command{awk} Without Input Files
@cindex standard input
address@hidden input, standard
address@hidden input files, running @command{awk} without
address@hidden input @subentry standard
address@hidden input files @subentry running @command{awk} without
You can also run @command{awk} without any input files. If you type the
following command line:
@@ -2505,9 +2505,9 @@ which usually means whatever you type on the keyboard.
This continues
until you indicate end-of-file by typing @kbd{Ctrl-d}.
(On non-POSIX operating systems, the end-of-file character may be different.)
address@hidden files, input, See input files
address@hidden input files, running @command{awk} without
address@hidden @command{awk} programs, running, without input files
address@hidden files, input @seeentry{input files}
address@hidden input files @subentry running @command{awk} without
address@hidden @command{awk} programs @subentry running @subentry without input
files
As an example, the following program prints a friendly piece of advice
(from Douglas Adams's @cite{The Hitchhiker's Guide to the Galaxy}),
to keep you from worrying about the complexities of computer
@@ -2553,9 +2553,9 @@ $ @kbd{awk '@{ print @}'}
@node Long
@subsection Running Long Programs
address@hidden @command{awk} programs, running
address@hidden @command{awk} programs, lengthy
address@hidden files, @command{awk} programs in
address@hidden @command{awk} programs @subentry running
address@hidden @command{awk} programs @subentry lengthy
address@hidden files @subentry @command{awk} programs in
Sometimes @command{awk} programs are very long. In these cases, it is
more convenient to put the program into a separate file. In order to tell
@command{awk} to use that file for its program, you type:
@@ -2565,7 +2565,7 @@ awk -f @var{source-file} @var{input-file1}
@var{input-file2} @dots{}
@end example
@cindex @option{-f} option
address@hidden command line, option @option{-f}
address@hidden command line @subentry option @option{-f}
The @option{-f} instructs the @command{awk} utility to get the
@command{awk} program from the file @var{source-file} (@pxref{Options}).
Any @value{FN} can be used for @var{source-file}. For example, you
@@ -2589,7 +2589,7 @@ does the same thing as this one:
awk 'BEGIN @{ print "Don\47t Panic!" @}'
@end example
address@hidden quoting, in @command{gawk} command lines
address@hidden quoting @subentry in @command{gawk} command lines
@noindent
This was explained earlier
(@pxref{Read Terminal}).
@@ -2601,8 +2601,8 @@ for programs that are provided on the @command{awk}
command line.
(Also, placing the program in a file allows us to use a literal single quote
in the program
text, instead of the magic @samp{\47}.)
address@hidden single quote (@code{'}) in @command{gawk} command lines
address@hidden @code{'} (single quote) in @command{gawk} command lines
address@hidden single quote (@code{'}) @subentry in @command{gawk} command lines
address@hidden @code{'} (single quote) @subentry in @command{gawk} command lines
If you want to clearly identify an @command{awk} program file as such,
you can add the extension @file{.awk} to the @value{FN}. This doesn't
affect the execution of the @command{awk} program but it does make
@@ -2611,9 +2611,9 @@ affect the execution of the @command{awk} program but it
does make
@node Executable Scripts
@subsection Executable @command{awk} Programs
@cindex @command{awk} programs
address@hidden @code{#} (number sign), @code{#!} (executable scripts)
address@hidden @code{#} (number sign) @subentry @code{#!} (executable scripts)
@cindex Unix, @command{awk} scripts and
address@hidden number sign (@code{#}), @code{#!} (executable scripts)
address@hidden number sign (@code{#}) @subentry @code{#!} (executable scripts)
Once you have learned @command{awk}, you may want to write self-contained
@command{awk} scripts, using the @samp{#!} script mechanism. You can do
@@ -2648,13 +2648,13 @@ Self-contained @command{awk} scripts are useful when
you want to write a
program that users can invoke without their having to know that the program is
written in @command{awk}.
address@hidden sidebar, Understanding @samp{#!}
address@hidden sidebar @subentry Understanding @samp{#!}
@ifdocbook
@docbook
<sidebar><title>Understanding @samp{#!}</title>
@end docbook
address@hidden portability, @code{#!} (executable scripts)
address@hidden portability @subentry @code{#!} (executable scripts)
@command{awk} is an @dfn{interpreted} language. This means that the
@command{awk} utility reads your program and then processes your data
@@ -2683,9 +2683,9 @@ treats the rest of the line as a single argument and
passes it to @command{awk}.
Doing this leads to confusing behavior---most likely a usage diagnostic
of some sort from @command{awk}.
address@hidden @code{ARGC}/@code{ARGV} variables, portability and
address@hidden portability, @code{ARGV} variable
address@hidden dark corner, @code{ARGV} variable, value of
address@hidden @code{ARGC}/@code{ARGV} variables @subentry portability and
address@hidden portability @subentry @code{ARGV} variable
address@hidden dark corner @subentry @code{ARGV} variable @subentry value of
Finally, the value of @code{ARGV[0]}
(@pxref{Built-in Variables})
varies depending upon your operating system.
@@ -2705,7 +2705,7 @@ to provide your script name.
@center @b{Understanding @samp{#!}}
address@hidden portability, @code{#!} (executable scripts)
address@hidden portability @subentry @code{#!} (executable scripts)
@command{awk} is an @dfn{interpreted} language. This means that the
@command{awk} utility reads your program and then processes your data
@@ -2734,9 +2734,9 @@ treats the rest of the line as a single argument and
passes it to @command{awk}.
Doing this leads to confusing behavior---most likely a usage diagnostic
of some sort from @command{awk}.
address@hidden @code{ARGC}/@code{ARGV} variables, portability and
address@hidden portability, @code{ARGV} variable
address@hidden dark corner, @code{ARGV} variable, value of
address@hidden @code{ARGC}/@code{ARGV} variables @subentry portability and
address@hidden portability @subentry @code{ARGV} variable
address@hidden dark corner @subentry @code{ARGV} variable @subentry value of
Finally, the value of @code{ARGV[0]}
(@pxref{Built-in Variables})
varies depending upon your operating system.
@@ -2750,10 +2750,10 @@ to provide your script name.
@node Comments
@subsection Comments in @command{awk} Programs
address@hidden @code{#} (number sign), commenting
address@hidden number sign (@code{#}), commenting
address@hidden @code{#} (number sign) @subentry commenting
address@hidden number sign (@code{#}) @subentry commenting
@cindex commenting
address@hidden @command{awk} programs, documenting
address@hidden @command{awk} programs @subentry documenting
A @dfn{comment} is some text that is included in a program for the sake
of human readers; it is not really an executable part of the program. Comments
@@ -2778,9 +2778,9 @@ programs, but this usually isn't very useful; the purpose
of a
comment is to help you or another person understand the program
when reading it at a later time.
address@hidden quoting, for small awk programs
address@hidden single quote (@code{'}), vs.@: apostrophe
address@hidden @code{'} (single quote), vs.@: apostrophe
address@hidden quoting @subentry for small awk programs
address@hidden single quote (@code{'}) @subentry vs.@: apostrophe
address@hidden @code{'} (single quote) @subentry vs.@: apostrophe
@quotation CAUTION
As mentioned in
@ref{One-shot},
@@ -2836,7 +2836,7 @@ the shell prompt, or writing it as part of a larger shell
script:
awk '@var{program text}' @var{input-file1} @var{input-file2} @dots{}
@end example
address@hidden shells, quoting, rules for
address@hidden shells @subentry quoting @subentry rules for
@cindex Bourne shell, quoting rules for
Once you are working with the shell, it is helpful to have a basic
knowledge of shell quoting rules. The following rules apply only to
@@ -2875,10 +2875,10 @@ that character. The shell removes the backslash and
passes the quoted
character on to the command.
@item
address@hidden @code{\} (backslash), in shell commands
address@hidden backslash (@code{\}), in shell commands
address@hidden single quote (@code{'}), in shell commands
address@hidden @code{'} (single quote), in shell commands
address@hidden @code{\} (backslash) @subentry in shell commands
address@hidden backslash (@code{\}) @subentry in shell commands
address@hidden single quote (@code{'}) @subentry in shell commands
address@hidden @code{'} (single quote) @subentry in shell commands
Single quotes protect everything between the opening and closing quotes.
The shell does no interpretation of the quoted text, passing it on verbatim
to the command.
@@ -2888,8 +2888,8 @@ Refer back to
for an example of what happens if you try.
@item
address@hidden double quote (@code{"}), in shell commands
address@hidden @code{"} (double quote), in shell commands
address@hidden double quote (@code{"}) @subentry in shell commands
address@hidden @code{"} (double quote) @subentry in shell commands
Double quotes protect most things between the opening and closing quotes.
The shell does at least variable and command substitution on the quoted text.
Different shells may do additional kinds of processing on double-quoted text.
@@ -2917,8 +2917,8 @@ $ @kbd{awk "BEGIN @{ print \"Don't Panic!\" @}"}
@print{} Don't Panic!
@end example
address@hidden single quote (@code{'}), with double quotes
address@hidden @code{'} (single quote), with double quotes
address@hidden single quote (@code{'}) @subentry with double quotes
address@hidden @code{'} (single quote) @subentry with double quotes
Note that the single quote is not special within double quotes.
@item
@@ -2932,7 +2932,7 @@ awk -F "" '@var{program}' @var{files} # correct
@end example
@noindent
address@hidden null strings in @command{gawk} arguments, quoting and
address@hidden null strings in @command{gawk} arguments @subentry quoting and
Don't use this:
@example
@@ -2945,7 +2945,7 @@ as the value of @code{FS}, and the first @value{FN} as
the text of the program!
This results in syntax errors at best, and confusing behavior at worst.
@end itemize
address@hidden quoting, in @command{gawk} command lines, tricks for
address@hidden quoting @subentry in @command{gawk} command lines @subentry
tricks for
Mixing single and double quotes is difficult. You have to resort
to shell quoting tricks, like this:
@@ -3107,7 +3107,7 @@ double-quote don't need duplication.
@node Sample Data Files
@section @value{DDF}s for the Examples
address@hidden input files, examples
address@hidden input files @subentry examples
@cindex @code{mail-list} file
Many of the examples in this @value{DOCUMENT} take their input from two sample
@value{DF}s. The first, @file{mail-list}, represents a list of peoples' names
@@ -3220,21 +3220,21 @@ $ @kbd{awk '/li/ @{ print $0 @}' mail-list}
@print{} Samuel 555-3430 samuel.lanceolis@@shu.edu A
@end example
address@hidden actions, default
address@hidden patterns, default
address@hidden actions @subentry default
address@hidden patterns @subentry default
In an @command{awk} rule, either the pattern or the action can be omitted,
but not both. If the pattern is omitted, then the action is performed
for @emph{every} input line. If the action is omitted, the default
action is to print all lines that match the pattern.
address@hidden actions, empty
address@hidden actions @subentry empty
Thus, we could leave out the action (the @code{print} statement and the
braces) in the previous example and the result would be the same:
@command{awk} prints all lines matching the pattern @samp{li}. By comparison,
omitting the @code{print} statement but retaining the braces makes an
empty action that does nothing (i.e., no lines are printed).
address@hidden @command{awk} programs, one-line examples
address@hidden @command{awk} programs @subentry one-line examples
Many practical @command{awk} programs are just a line or two long. Following
is a
collection of useful, short programs to get you started. Some of these
programs contain constructs that haven't been covered yet. (The description
@@ -3439,7 +3439,7 @@ the file was last modified. Its output looks like this:
@end example
@noindent
address@hidden line continuations, with C shell
address@hidden line continuations @subentry with C shell
The first field contains read-write permissions, the second field contains
the number of links to the file, and the third field identifies the file's
owner.
The fourth field identifies the file's group.
@@ -3485,7 +3485,7 @@ awk '/12/ @{ print $0 @}
/21/ @{ print $0 @}' mail-list inventory-shipped
@end example
address@hidden @command{gawk}, newlines in
address@hidden @command{gawk} @subentry newlines in
However, @command{gawk} ignores newlines after any of the following
symbols and keywords:
@@ -3502,8 +3502,8 @@ Splitting lines after @samp{?} and @samp{:} is a minor
@command{gawk}
extension; if @option{--posix} is specified
(@pxref{Options}), then this extension is disabled.}
address@hidden @code{\} (backslash), continuing lines and
address@hidden backslash (@code{\}), continuing lines and
address@hidden @code{\} (backslash) @subentry continuing lines and
address@hidden backslash (@code{\}) @subentry continuing lines and
If you would like to split a single statement into two lines at a point
where a newline would terminate it, you can @dfn{continue} it by ending the
first line with a backslash character (@samp{\}). The backslash must be
@@ -3517,7 +3517,7 @@ awk '/This regular expression is too long, so continue it\
@end example
@noindent
address@hidden portability, backslash continuation and
address@hidden portability @subentry backslash continuation and
We have generally not used backslash continuation in our sample programs.
@command{gawk} places no limit on the
length of a line, so backslash continuation is never strictly necessary;
@@ -3535,8 +3535,8 @@ lines in the middle of a regular expression or a string.
@c solaris 2.7 nawk does not. Solaris /usr/xpg4/bin/awk does though! sigh.
@cindex @command{csh} utility
address@hidden backslash (@code{\}), continuing lines and, in @command{csh}
address@hidden @code{\} (backslash), continuing lines and, in @command{csh}
address@hidden backslash (@code{\}) @subentry continuing lines and @subentry in
@command{csh}
address@hidden @code{\} (backslash) @subentry continuing lines and @subentry in
@command{csh}
@quotation CAUTION
@emph{Backslash continuation does not work as described
with the C shell.} It works for @command{awk} programs in files and
@@ -3574,8 +3574,8 @@ begin on the same line as the pattern. To have the
pattern and action
on separate lines, you @emph{must} use backslash continuation; there
is no other option.
address@hidden backslash (@code{\}), continuing lines and, comments and
address@hidden @code{\} (backslash), continuing lines and, comments and
address@hidden backslash (@code{\}) @subentry continuing lines and @subentry
comments and
address@hidden @code{\} (backslash) @subentry continuing lines and @subentry
comments and
@cindex commenting, backslash continuation and
Another thing to keep in mind is that backslash continuation and
comments do not mix. As soon as @command{awk} sees the @samp{#} that
@@ -3598,11 +3598,11 @@ next line. However, the backslash-newline combination
is never even
noticed because it is ``hidden'' inside the comment. Thus, the
@code{BEGIN} is noted as a syntax error.
address@hidden statements, multiple
address@hidden @code{;} (semicolon), separating statements in actions
address@hidden semicolon (@code{;}), separating statements in actions
address@hidden @code{;} (semicolon), separating rules
address@hidden semicolon (@code{;}), separating rules
address@hidden statements @subentry multiple
address@hidden @code{;} (semicolon) @subentry separating statements in actions
address@hidden semicolon (@code{;}) @subentry separating statements in actions
address@hidden @code{;} (semicolon) @subentry separating rules
address@hidden semicolon (@code{;}) @subentry separating rules
When @command{awk} statements within one rule are short, you might want to put
more than one of them on a line. This is accomplished by separating the
statements
with a semicolon (@samp{;}).
@@ -3645,7 +3645,7 @@ systematically in @ref{Built-in Variables} and in
@node When
@section When to Use @command{awk}
address@hidden @command{awk}, uses for
address@hidden @command{awk} @subentry uses for
Now that you've seen some of what @command{awk} can do,
you might wonder how @command{awk} could be useful for you. By using
utility programs, advanced patterns, field separators, arithmetic
@@ -3676,7 +3676,7 @@ computer.
The original @command{awk}'s capabilities were strained by tasks
of such complexity, but modern versions are more capable.
address@hidden @command{awk} programs, complex
address@hidden @command{awk} programs @subentry complex
If you find yourself writing @command{awk} scripts of more than, say,
a few hundred lines, you might consider using a different programming
language. The shell is good at string and pattern matching; in addition,
@@ -3756,10 +3756,10 @@ things in this @value{CHAPTER} that don't interest you
right now.
@node Command Line
@section Invoking @command{awk}
address@hidden command line, invoking @command{awk} from
address@hidden @command{awk}, invoking
address@hidden arguments, command-line, invoking @command{awk}
address@hidden options, command-line, invoking @command{awk}
address@hidden command line @subentry invoking @command{awk} from
address@hidden @command{awk} @subentry invoking
address@hidden arguments @subentry command-line @subentry invoking @command{awk}
address@hidden options @subentry command-line @subentry invoking @command{awk}
There are two ways to run @command{awk}---with an explicit program or with
one or more program files. Here are templates for both of them; items
@@ -3772,12 +3772,12 @@ enclosed in address@hidden in these templates are
optional:
@cindex GNU long options
@cindex long options
address@hidden options, long
address@hidden options @subentry long
In addition to traditional one-letter POSIX-style options, @command{gawk} also
supports GNU long options.
address@hidden dark corner, invoking @command{awk}
address@hidden lint checking, empty programs
address@hidden dark corner @subentry invoking @command{awk}
address@hidden lint checking @subentry empty programs
It is possible to invoke @command{awk} with an empty program:
@example
@@ -3785,7 +3785,7 @@ awk '' datafile1 datafile2
@end example
@cindex @option{--lint} option
address@hidden dark corner, empty programs
address@hidden dark corner @subentry empty programs
@noindent
Doing so makes little sense, though; @command{awk} exits
silently when given an empty program.
@@ -3796,10 +3796,10 @@ warning that the program is empty.
@node Options
@section Command-Line Options
address@hidden options, command-line
address@hidden command line, options
address@hidden options @subentry command-line
address@hidden command line @subentry options
@cindex GNU long options
address@hidden options, long
address@hidden options @subentry long
Options begin with a dash and consist of a single character.
GNU-style long options consist of two dashes and a keyword.
@@ -3811,7 +3811,7 @@ by whitespace.
If a particular option with a value is given more than once, it is the
last value that counts.
address@hidden POSIX @command{awk}, GNU long options and
address@hidden POSIX @command{awk} @subentry GNU long options and
Each long option for @command{gawk} has a corresponding
POSIX-style short option.
The long and short options are
@@ -3823,7 +3823,7 @@ The following list describes options mandated by the
POSIX standard:
@itemx --field-separator @var{fs}
@cindex @option{-F} option
@cindex @option{--field-separator} option
address@hidden @code{FS} variable, @code{--field-separator} option and
address@hidden @code{FS} variable @subentry @code{--field-separator} option and
Set the @code{FS} variable to @var{fs}
(@pxref{Field Separators}).
@@ -3831,7 +3831,7 @@ Set the @code{FS} variable to @var{fs}
@itemx --file @var{source-file}
@cindex @option{-f} option
@cindex @option{--file} option
address@hidden @command{awk} programs, location of
address@hidden @command{awk} programs @subentry location of
Read the @command{awk} program source from @var{source-file}
instead of in the first nonoption argument.
This option may be given multiple times; the @command{awk}
@@ -3845,7 +3845,7 @@ at their beginning. @xref{Changing The Namespace}, for
more information.
@itemx --assign @address@hidden
@cindex @option{-v} option
@cindex @option{--assign} option
address@hidden variables, setting
address@hidden variables @subentry setting
Set the variable @var{var} to the value @var{val} @emph{before}
execution of the program begins. Such variable values are available
inside the @code{BEGIN} rule
@@ -3855,8 +3855,8 @@ The @option{-v} option can only set one variable, but it
can be used
more than once, setting another variable each time, like this:
@samp{awk @w{-v foo=1} @w{-v bar=2} @dots{}}.
address@hidden predefined variables, @code{-v} address@hidden setting with
address@hidden variables, predefined, @code{-v} address@hidden setting with
address@hidden predefined variables @subentry @code{-v} option, setting with
address@hidden variables @subentry predefined @subentry @code{-v} option,
setting with
@quotation CAUTION
Using @option{-v} to set the values of the built-in
variables may lead to surprising results. @command{awk} will reset the
@@ -3875,15 +3875,15 @@ the abbreviations remain unique.
The full list of @command{gawk}-specific options is provided next.
@item --
address@hidden command line, options, end of
address@hidden options, command-line, end of
address@hidden command line @subentry options @subentry end of
address@hidden options @subentry command-line @subentry end of
Signal the end of the command-line options. The following arguments
are not treated as options even if they begin with @samp{-}. This
interpretation of @option{--} follows the POSIX argument parsing
conventions.
address@hidden @code{-} (hyphen), file names beginning with
address@hidden hyphen (@code{-}), file names beginning with
address@hidden @code{-} (hyphen) @subentry file names beginning with
address@hidden hyphen (@code{-}) @subentry file names beginning with
This is useful if you have @value{FN}s that start with @samp{-},
or in shell scripts, if you have @value{FN}s that will be specified
by the user that could start with @samp{-}.
@@ -3914,7 +3914,7 @@ multibyte characters. This option is an easy way to tell
@command{gawk},
@itemx @option{--traditional}
@cindex @option{-c} option
@cindex @option{--traditional} option
address@hidden compatibility mode (@command{gawk}), specifying
address@hidden compatibility mode (@command{gawk}) @subentry specifying
Specify @dfn{compatibility mode}, in which the GNU extensions to
the @command{awk} language are disabled, so that @command{gawk} behaves just
like BWK @command{awk}.
@@ -3938,15 +3938,15 @@ Print the short version of the General Public License
and then exit.
@cindex @option{--dump-variables} option
@cindex dump all variables of a program
@cindex @file{awkvars.out} file
address@hidden files, @file{awkvars.out}
address@hidden variables, global, printing list of
address@hidden files @subentry @file{awkvars.out}
address@hidden variables @subentry global @subentry printing list of
Print a sorted list of global variables, their types, and final values
to @var{file}. If no @var{file} is provided, print this
list to a file named @file{awkvars.out} in the current directory.
No space is allowed between the @option{-d} and @var{file}, if
@var{file} is supplied.
address@hidden troubleshooting, typographical address@hidden global variables
address@hidden troubleshooting @subentry typographical errors, global variables
Having a list of all global variables is a good way to look for
typographical errors in your programs.
You would also use this option if you have a large program with a lot of
@@ -3973,7 +3973,7 @@ No space is allowed between the @option{-D} and
@var{file}, if
@itemx @option{--source} @var{program-text}
@cindex @option{-e} option
@cindex @option{--source} option
address@hidden source code, mixing
address@hidden source code @subentry mixing
Provide program source code in the @var{program-text}.
This option allows you to mix source code in files with source
code that you enter on the command line.
@@ -4008,7 +4008,7 @@ for more information.
@itemx @option{--exec} @var{file}
@cindex @option{-E} option
@cindex @option{--exec} option
address@hidden @command{awk} programs, location of
address@hidden @command{awk} programs @subentry location of
@cindex CGI, @command{awk} scripts for
Similar to @option{-f}, read @command{awk} program text from @var{file}.
There are two differences from @option{-f}:
@@ -4045,8 +4045,8 @@ with @samp{#!} scripts (@pxref{Executable Scripts}), like
so:
@itemx @option{--gen-pot}
@cindex @option{-g} option
@cindex @option{--gen-pot} option
address@hidden portable object files, generating
address@hidden files, portable object, generating
address@hidden portable object files @subentry generating
address@hidden files @subentry portable object @subentry generating
Analyze the source program and
generate a GNU @command{gettext} portable object template file on standard
output for all string constants that have been marked for translation.
@@ -4058,8 +4058,8 @@ for information about this option.
@cindex @option{-h} option
@cindex @option{--help} option
@cindex GNU long options, printing list of
address@hidden options, printing list of
address@hidden printing, list of options
address@hidden options @subentry printing list of
address@hidden printing @subentry list of options
Print a ``usage'' message summarizing the short- and long-style options
that @command{gawk} accepts and then exit.
@@ -4067,7 +4067,7 @@ that @command{gawk} accepts and then exit.
@itemx @option{--include} @var{source-file}
@cindex @option{-i} option
@cindex @option{--include} option
address@hidden @command{awk} programs, location of
address@hidden @command{awk} programs @subentry location of
Read an @command{awk} source library from @var{source-file}. This option
is completely equivalent to using the @code{@@include} directive inside
your program. It is very similar to the @option{-f} option,
@@ -4087,7 +4087,7 @@ at their beginning. @xref{Changing The Namespace}, for
more information.
@itemx @option{--load} @var{ext}
@cindex @option{-l} option
@cindex @option{--load} option
address@hidden loading extensions
address@hidden loading, extensions
Load a dynamic extension named @var{ext}. Extensions
are stored as system shared libraries.
This option searches for the library using the @env{AWKLIBPATH}
@@ -4101,7 +4101,7 @@ a shared library. This advanced feature is described in
detail in @ref{Dynamic
@itemx @address@hidden@var{value}]
@cindex @option{-l} option
@cindex @option{--lint} option
address@hidden lint checking, issuing warnings
address@hidden lint checking @subentry issuing warnings
@cindex warnings, issuing
Warn about constructs that are dubious or nonportable to
other @command{awk} implementations.
@@ -4136,7 +4136,7 @@ if @command{gawk} is not compiled to use the GNU MPFR and
MP libraries
@cindex @option{--non-decimal-data} option
@cindex hexadecimal address@hidden enabling interpretation of
@cindex octal address@hidden enabling interpretation of
address@hidden troubleshooting, @code{--non-decimal-data} option
address@hidden troubleshooting @subentry @code{--non-decimal-data} option
Enable automatic interpretation of octal and hexadecimal
values in input data
(@pxref{Nondecimal Data}).
@@ -4207,7 +4207,7 @@ in the left margin, and function call counts for each
function.
@cindex @option{-P} option
@cindex @option{--posix} option
@cindex POSIX mode
address@hidden @command{gawk}, address@hidden disabling
address@hidden @command{gawk} @subentry extensions, disabling
Operate in strict POSIX mode. This disables all @command{gawk}
extensions (just like @option{--traditional}) and
disables all extensions not allowed by POSIX.
@@ -4220,13 +4220,13 @@ restrictions apply:
@itemize @value{BULLET}
@cindex newlines
address@hidden whitespace, newlines as
address@hidden whitespace @subentry newlines as
@item
Newlines are not allowed after @samp{?} or @samp{:}
(@pxref{Conditional Exp}).
address@hidden @code{FS} variable, TAB character as
address@hidden @code{FS} variable @subentry TAB character as
@item
Specifying @samp{-Ft} on the command line does not set the value
of @code{FS} to be a single TAB character
@@ -4241,8 +4241,8 @@ data (@pxref{Locales}).
@c @cindex automatic warnings
@c @cindex warnings, automatic
address@hidden @option{--traditional} option, @code{--posix} option and
address@hidden @option{--posix} option, @code{--traditional} option and
address@hidden @option{--traditional} option @subentry @code{--posix} option and
address@hidden @option{--posix} option @subentry @code{--traditional} option and
If you supply both @option{--traditional} and @option{--posix} on the
command line, @option{--posix} takes precedence. @command{gawk}
issues a warning if both options are supplied.
@@ -4251,7 +4251,7 @@ issues a warning if both options are supplied.
@itemx @option{--re-interval}
@cindex @option{-r} option
@cindex @option{--re-interval} option
address@hidden regular expressions, interval expressions and
address@hidden regular expressions @subentry interval expressions and
Allow interval expressions
(@pxref{Regexp Operators})
in regexps.
@@ -4291,7 +4291,7 @@ Warn about constructs that are not available in the
original version of
@itemx @option{--version}
@cindex @option{-V} option
@cindex @option{--version} option
address@hidden @command{gawk}, versions of, information address@hidden printing
address@hidden @command{gawk} @subentry versions of @subentry information
about, printing
Print version information for this particular copy of @command{gawk}.
This allows you to determine if your copy of @command{gawk} is up to date
with respect to whatever the Free Software Foundation is currently
@@ -4304,14 +4304,14 @@ As long as program text has been supplied,
any other options are flagged as invalid with a warning message but
are otherwise ignored.
address@hidden @option{-F} option, @option{-Ft} sets @code{FS} to TAB
address@hidden @option{-F} option @subentry @option{-Ft} sets @code{FS} to TAB
In compatibility mode, as a special case, if the value of @var{fs} supplied
to the @option{-F} option is @samp{t}, then @code{FS} is set to the TAB
character (@code{"\t"}). This is true only for @option{--traditional} and not
for @option{--posix}
(@pxref{Field Separators}).
address@hidden @option{-f} option, multiple uses
address@hidden @option{-f} option @subentry multiple uses
The @option{-f} option may be used more than once on the command line.
If it is, @command{awk} reads its program source from all of the named files,
as
if they had been concatenated together into one big file. This is
@@ -4345,7 +4345,7 @@ uses the first nonoption command-line argument as the
text of the
program source code.
@cindex @env{POSIXLY_CORRECT} environment variable
address@hidden lint checking, @env{POSIXLY_CORRECT} environment variable
address@hidden lint checking @subentry @env{POSIXLY_CORRECT} environment
variable
@cindex POSIX mode
If the environment variable @env{POSIXLY_CORRECT} exists,
then @command{gawk} behaves in strict POSIX mode, exactly as if
@@ -4367,7 +4367,7 @@ POSIXLY_CORRECT=true
export POSIXLY_CORRECT
@end example
address@hidden @command{csh} utility, @env{POSIXLY_CORRECT} environment variable
address@hidden @command{csh} utility @subentry @env{POSIXLY_CORRECT}
environment variable
For a C shell-compatible
shell,@footnote{Not recommended.}
you would add this line to the @file{.login} file in your home directory:
@@ -4376,15 +4376,15 @@ you would add this line to the @file{.login} file in
your home directory:
setenv POSIXLY_CORRECT true
@end example
address@hidden portability, @env{POSIXLY_CORRECT} environment variable
address@hidden portability @subentry @env{POSIXLY_CORRECT} environment variable
Having @env{POSIXLY_CORRECT} set is not recommended for daily use,
but it is good for testing the portability of your programs to other
environments.
@node Other Arguments
@section Other Command-Line Arguments
address@hidden command line, arguments
address@hidden arguments, command-line
address@hidden command line @subentry arguments
address@hidden arguments @subentry command-line
Any additional arguments on the command line are normally treated as
input files to be processed in the order specified. However, an
@@ -4397,10 +4397,10 @@ file at all. (See @ref{Assignment Options}.) In the
following example,
awk -f program.awk file1 count=1 file2
@end example
address@hidden @command{gawk}, @code{ARGIND} variable in
address@hidden @code{ARGIND} variable, command-line arguments
address@hidden @command{gawk} @subentry @code{ARGIND} variable in
address@hidden @code{ARGIND} variable @subentry command-line arguments
@cindex @code{ARGV} array, indexing into
address@hidden @code{ARGC}/@code{ARGV} variables, command-line arguments
address@hidden @code{ARGC}/@code{ARGV} variables @subentry command-line
arguments
All the command-line arguments are made available to your @command{awk}
program in the
@code{ARGV} array (@pxref{Built-in Variables}). Command-line options
and the program text (if present) are omitted from @code{ARGV}.
@@ -4414,7 +4414,7 @@ Changing @code{ARGC} and @code{ARGV} in your
@command{awk} program lets
you control how @command{awk} processes the input files; this is described
in more detail in @ref{ARGC and ARGV}.
address@hidden input files, variable assignments and
address@hidden input files @subentry variable assignments and
@cindex variable assignments and input files
The distinction between @value{FN} arguments and variable-assignment
arguments is made when @command{awk} is about to open the next input file.
@@ -4429,7 +4429,7 @@ variables assigned in this fashion are @emph{not}
available inside a
(@pxref{BEGIN/END}),
because such rules are run before @command{awk} begins scanning the argument
list.
address@hidden dark corner, escape sequences
address@hidden dark corner @subentry escape sequences
The variable values given on the command line are processed for escape
sequences (@pxref{Escape Sequences}).
@value{DARKCORNER}
@@ -4450,7 +4450,7 @@ output formats, before scanning the @value{DF}s. It is
also useful for
controlling state if multiple passes are needed over a @value{DF}. For
example:
address@hidden files, multiple passes over
address@hidden files @subentry multiple passes over
@example
awk 'pass == 1 @{ @var{pass 1 stuff} @}
pass == 2 @{ @var{pass 2 stuff} @}' pass=1 mydata pass=2 mydata
@@ -4511,9 +4511,9 @@ behaves.
@node AWKPATH Variable
@subsection The @env{AWKPATH} Environment Variable
@cindex @env{AWKPATH} environment variable
address@hidden directories, searching for source files
address@hidden search paths, for source files
address@hidden differences in @command{awk} and @command{gawk}, @env{AWKPATH}
environment variable
address@hidden directories @subentry searching for source files
address@hidden search paths @subentry for source files
address@hidden differences in @command{awk} and @command{gawk} @subentry
@env{AWKPATH} environment variable
@ifinfo
The previous @value{SECTION} described how @command{awk} program files can be
named
on the command line with the @option{-f} option.
@@ -4597,9 +4597,9 @@ found, and @command{gawk} no longer needs to use
@env{AWKPATH}.
@node AWKLIBPATH Variable
@subsection The @env{AWKLIBPATH} Environment Variable
@cindex @env{AWKLIBPATH} environment variable
address@hidden directories, searching for loadable extensions
address@hidden search paths, for loadable extensions
address@hidden differences in @command{awk} and @command{gawk},
@code{AWKLIBPATH} environment variable
address@hidden directories @subentry searching for loadable extensions
address@hidden search paths @subentry for loadable extensions
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{AWKLIBPATH} environment variable
The @env{AWKLIBPATH} environment variable is similar to the @env{AWKPATH}
variable, but it is used to search for loadable extensions (stored as
@@ -4729,7 +4729,7 @@ calls from the GNU C library to help track down possible
memory leaks.
@node Exit Status
@section @command{gawk}'s Exit Status
address@hidden exit status, of @command{gawk}
address@hidden exit status @subentry of @command{gawk}
If the @code{exit} statement is used with a value
(@pxref{Exit Statement}), then @command{gawk} exits with
the numeric value given to it.
@@ -4883,7 +4883,7 @@ This @value{SECTION} describes a feature that is specific
to @command{gawk}.
@cindex @code{@@load} directive
@cindex loading extensions, @code{@@load} directive
address@hidden extensions, loading, @code{@@load} directive
address@hidden extensions @subentry loading @subentry @code{@@load} directive
The @code{@@load} keyword can be used to read external @command{awk} extensions
(stored as system shared libraries).
This allows you to link in compiled code that may offer superior
@@ -4926,8 +4926,8 @@ It also describes the @code{ordchr} extension.
@c update this section for each release!
address@hidden options, deprecated
address@hidden features, deprecated
address@hidden options @subentry deprecated
address@hidden features @subentry deprecated
@cindex obsolete features
This @value{SECTION} describes features and/or command-line options from
previous releases of @command{gawk} that either are not available in the
@@ -4949,7 +4949,7 @@ in case some option becomes obsolete in a future version
of @command{gawk}.
@node Undocumented
@section Undocumented Options and Features
@cindex undocumented features
address@hidden features, undocumented
address@hidden features @subentry undocumented
@cindex Skywalker, Luke
@cindex Kenobi, Obi-Wan
@cindex jedi knights
@@ -4959,7 +4959,7 @@ in case some option becomes obsolete in a future version
of @command{gawk}.
@author Obi-Wan
@end quotation
address@hidden shells, sea
address@hidden shells @subentry sea
This @value{SECTION} intentionally left
blank.
@@ -5100,8 +5100,8 @@ set of strings.
Because regular expressions are such a fundamental part of @command{awk}
programming, their format and use deserve a separate @value{CHAPTER}.
address@hidden forward slash (@code{/}) to enclose regular expressions
address@hidden @code{/} (forward slash) to enclose regular expressions
address@hidden forward slash (@code{/}) @subentry to enclose regular expressions
address@hidden @code{/} (forward slash) @subentry to enclose regular expressions
A regular expression enclosed in slashes (@samp{/})
is an @command{awk} pattern that matches every input record whose text
belongs to that set.
@@ -5133,8 +5133,8 @@ regular expressions work, we present more complicated
instances.
@node Regexp Usage
@section How to Use Regular Expressions
address@hidden patterns, regular expressions as
address@hidden regular expressions, as patterns
address@hidden patterns @subentry regular expressions as
address@hidden regular expressions @subentry as patterns
A regular expression can be used as a pattern by enclosing it in
slashes. Then the regular expression is tested against the
entire text of each record. (Normally, it only needs
@@ -5150,16 +5150,16 @@ $ @kbd{awk '/li/ @{ print $2 @}' mail-list}
@print{} 555-3430
@end example
address@hidden regular expressions, operators
address@hidden operators, string-matching
address@hidden regular expressions @subentry operators
address@hidden operators @subentry string-matching
@c @cindex operators, @code{~}
@cindex string-matching operators
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
@c @cindex operators, @code{!~}
address@hidden @code{if} statement, use of regexps in
address@hidden @code{if} statement @subentry use of regexps in
@cindex @code{while} statement, use of regexps in
@cindex @address@hidden statement, use of regexps in
@c @cindex statements, @code{if}
@@ -5220,7 +5220,7 @@ $ @kbd{awk '$1 !~ /J/' inventory-shipped}
@cindex regexp constants
@cindex constant regexps
address@hidden regular expressions, constants, See regexp constants
address@hidden regular expressions, constants @seeentry{regexp constants}
When a regexp is enclosed in slashes, such as @code{/foo/}, we call it
a @dfn{regexp constant}, much like @code{5.27} is a numeric constant and
@code{"foo"} is a string constant.
@@ -5228,9 +5228,9 @@ a @dfn{regexp constant}, much like @code{5.27} is a
numeric constant and
@node Escape Sequences
@section Escape Sequences
address@hidden escape sequences, in strings
address@hidden backslash (@code{\}), in escape sequences
address@hidden @code{\} (backslash), in escape sequences
address@hidden escape sequences @subentry in strings
address@hidden backslash (@code{\}) @subentry in escape sequences
address@hidden @code{\} (backslash) @subentry in escape sequences
Some characters cannot be included literally in string constants
(@code{"foo"}) or regexp constants (@code{/foo/}).
Instead, they should be represented with @dfn{escape sequences},
@@ -5265,45 +5265,45 @@ sequences apply to both string constants and regexp
constants:
A literal backslash, @samp{\}.
@c @cindex @command{awk} language, V.4 version
address@hidden @code{\} (backslash), @code{\a} escape sequence
address@hidden backslash (@code{\}), @code{\a} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\a} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\a} escape sequence
@item \a
The ``alert'' character, @kbd{Ctrl-g}, ASCII code 7 (BEL).
(This often makes some sort of audible noise.)
address@hidden @code{\} (backslash), @code{\b} escape sequence
address@hidden backslash (@code{\}), @code{\b} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\b} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\b} escape sequence
@item \b
Backspace, @kbd{Ctrl-h}, ASCII code 8 (BS).
address@hidden @code{\} (backslash), @code{\f} escape sequence
address@hidden backslash (@code{\}), @code{\f} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\f} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\f} escape sequence
@item \f
Formfeed, @kbd{Ctrl-l}, ASCII code 12 (FF).
address@hidden @code{\} (backslash), @code{\n} escape sequence
address@hidden backslash (@code{\}), @code{\n} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\n} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\n} escape sequence
@item \n
Newline, @kbd{Ctrl-j}, ASCII code 10 (LF).
address@hidden @code{\} (backslash), @code{\r} escape sequence
address@hidden backslash (@code{\}), @code{\r} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\r} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\r} escape sequence
@item \r
Carriage return, @kbd{Ctrl-m}, ASCII code 13 (CR).
address@hidden @code{\} (backslash), @code{\t} escape sequence
address@hidden backslash (@code{\}), @code{\t} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\t} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\t} escape sequence
@item \t
Horizontal TAB, @kbd{Ctrl-i}, ASCII code 9 (HT).
@c @cindex @command{awk} language, V.4 version
address@hidden @code{\} (backslash), @code{\v} escape sequence
address@hidden backslash (@code{\}), @code{\v} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\v} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\v} escape sequence
@item \v
Vertical TAB, @kbd{Ctrl-k}, ASCII code 11 (VT).
address@hidden @code{\} (backslash), @address@hidden escape sequence
address@hidden backslash (@code{\}), @address@hidden escape sequence
address@hidden @code{\} (backslash) @subentry @address@hidden escape sequence
address@hidden backslash (@code{\}) @subentry @address@hidden escape sequence
@item address@hidden
The octal value @var{nnn}, where @var{nnn} stands for 1 to 3 digits
between @samp{0} and @samp{7}. For example, the code for the ASCII ESC
@@ -5311,10 +5311,10 @@ between @samp{0} and @samp{7}. For example, the code
for the ASCII ESC
@c @cindex @command{awk} language, V.4 version
@c @cindex @command{awk} language, POSIX version
address@hidden @code{\} (backslash), @code{\x} escape sequence
address@hidden backslash (@code{\}), @code{\x} escape sequence
address@hidden common extensions, @code{\x} escape sequence
address@hidden extensions, address@hidden @code{\x} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\x} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\x} escape sequence
address@hidden common extensions @subentry @code{\x} escape sequence
address@hidden extensions @subentry common, @code{\x} escape sequence
@item address@hidden@dots{}
The hexadecimal value @var{hh}, where @var{hh} stands for a sequence
of hexadecimal digits (@address@hidden, and either @address@hidden
@@ -5335,8 +5335,8 @@ As of @value{PVERSION} 4.2, only two digits
are processed.
@end quotation
address@hidden @code{\} (backslash), @code{\/} escape sequence
address@hidden backslash (@code{\}), @code{\/} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\/} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\/} escape sequence
@item \/
A literal slash (necessary for regexp constants only).
This sequence is used when you want to write a regexp
@@ -5347,8 +5347,8 @@ Because the regexp is delimited by
slashes, you need to escape any slash that is part of the pattern,
in order to tell @command{awk} to keep processing the rest of the regexp.
address@hidden @code{\} (backslash), @code{\"} escape sequence
address@hidden backslash (@code{\}), @code{\"} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\"} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\"} escape sequence
@item \"
A literal double quote (necessary for string constants only).
This sequence is used when you want to write a string
@@ -5370,25 +5370,25 @@ means that the next character should be taken
literally, even if it would
normally be a regexp operator. For example, @code{/a\+b/} matches the three
characters @samp{a+b}.
address@hidden backslash (@code{\}), in escape sequences
address@hidden @code{\} (backslash), in escape sequences
address@hidden backslash (@code{\}) @subentry in escape sequences
address@hidden @code{\} (backslash) @subentry in escape sequences
@cindex portability
For complete portability, do not use a backslash before any character not
shown in the previous list or that is not an operator.
@c 11/2014: Moved so as to not stack sidebars
address@hidden sidebar, Backslash Before Regular Characters
address@hidden sidebar @subentry Backslash Before Regular Characters
@ifdocbook
@docbook
<sidebar><title>Backslash Before Regular Characters</title>
@end docbook
address@hidden portability, backslash in escape sequences
address@hidden POSIX @command{awk}, backslashes in string constants
address@hidden backslash (@code{\}), in escape sequences, POSIX and
address@hidden @code{\} (backslash), in escape sequences, POSIX and
address@hidden portability @subentry backslash in escape sequences
address@hidden POSIX @command{awk} @subentry backslashes in string constants
address@hidden backslash (@code{\}) @subentry in escape sequences @subentry
POSIX and
address@hidden @code{\} (backslash) @subentry in escape sequences @subentry
POSIX and
address@hidden troubleshooting, backslash before nonspecial character
address@hidden troubleshooting @subentry backslash before nonspecial character
If you place a backslash in a string constant before something that is
not one of the characters previously listed, POSIX @command{awk} purposely
leaves what happens as undefined. There are two choices:
@@ -5407,8 +5407,8 @@ surrounded by whitespace as the field separator. There
should be
two backslashes in the string: @samp{FS = @w{"[ \t]+\\|[ \t]+"}}.)
@c I did this! This is why I added the warning.
address@hidden @command{gawk}, escape sequences
address@hidden Unix @command{awk}, backslashes in escape sequences
address@hidden @command{gawk} @subentry escape sequences
address@hidden Unix @command{awk} @subentry backslashes in escape sequences
@cindex @command{mawk} utility
@item Leave the backslash alone
Some other @command{awk} implementations do this.
@@ -5426,12 +5426,12 @@ In such implementations, typing @code{"a\qc"} is the
same as typing
@center @b{Backslash Before Regular Characters}
address@hidden portability, backslash in escape sequences
address@hidden POSIX @command{awk}, backslashes in string constants
address@hidden backslash (@code{\}), in escape sequences, POSIX and
address@hidden @code{\} (backslash), in escape sequences, POSIX and
address@hidden portability @subentry backslash in escape sequences
address@hidden POSIX @command{awk} @subentry backslashes in string constants
address@hidden backslash (@code{\}) @subentry in escape sequences @subentry
POSIX and
address@hidden @code{\} (backslash) @subentry in escape sequences @subentry
POSIX and
address@hidden troubleshooting, backslash before nonspecial character
address@hidden troubleshooting @subentry backslash before nonspecial character
If you place a backslash in a string constant before something that is
not one of the characters previously listed, POSIX @command{awk} purposely
leaves what happens as undefined. There are two choices:
@@ -5450,8 +5450,8 @@ surrounded by whitespace as the field separator. There
should be
two backslashes in the string: @samp{FS = @w{"[ \t]+\\|[ \t]+"}}.)
@c I did this! This is why I added the warning.
address@hidden @command{gawk}, escape sequences
address@hidden Unix @command{awk}, backslashes in escape sequences
address@hidden @command{gawk} @subentry escape sequences
address@hidden Unix @command{awk} @subentry backslashes in escape sequences
@cindex @command{mawk} utility
@item Leave the backslash alone
Some other @command{awk} implementations do this.
@@ -5480,7 +5480,7 @@ A backslash before any other character means to treat
that character
literally.
@end itemize
address@hidden sidebar, Escape Sequences for Metacharacters
address@hidden sidebar @subentry Escape Sequences for Metacharacters
@ifdocbook
@docbook
<sidebar><title>Escape Sequences for Metacharacters</title>
@@ -5494,7 +5494,7 @@ escape to represent a regexp metacharacter.
Does @command{awk} treat the character as a literal character or as a regexp
operator?
address@hidden dark corner, escape sequences, for metacharacters
address@hidden dark corner @subentry escape sequences @subentry for
metacharacters
Historically, such characters were taken literally.
@value{DARKCORNER}
However, the POSIX standard indicates that they should be treated
@@ -5522,7 +5522,7 @@ escape to represent a regexp metacharacter.
Does @command{awk} treat the character as a literal character or as a regexp
operator?
address@hidden dark corner, escape sequences, for metacharacters
address@hidden dark corner @subentry escape sequences @subentry for
metacharacters
Historically, such characters were taken literally.
@value{DARKCORNER}
However, the POSIX standard indicates that they should be treated
@@ -5536,7 +5536,7 @@ escape sequences literally when used in regexp constants.
Thus,
@node Regexp Operators
@section Regular Expression Operators
address@hidden regular expressions, operators
address@hidden regular expressions @subentry operators
@cindex metacharacters in regular expressions
You can combine regular expressions with special characters,
@@ -5565,17 +5565,17 @@ sequences and that are not listed here stand for
themselves:
@c Use @asis so the docbook comes out ok. Sigh.
@table @asis
address@hidden backslash (@code{\}), regexp operator
address@hidden @code{\} (backslash), regexp operator
address@hidden backslash (@code{\}) @subentry regexp operator
address@hidden @code{\} (backslash) @subentry regexp operator
@item @code{\}
This suppresses the special meaning of a character when
matching. For example, @samp{\$}
matches the character @samp{$}.
address@hidden regular expressions, anchors in
address@hidden Texinfo, chapter beginnings in files
address@hidden @code{^} (caret), regexp operator
address@hidden caret (@code{^}), regexp operator
address@hidden regular expressions @subentry anchors in
address@hidden Texinfo @subentry chapter beginnings in files
address@hidden @code{^} (caret) @subentry regexp operator
address@hidden caret (@code{^}) @subentry regexp operator
@item @code{^}
This matches the beginning of a string. @samp{^@@chapter}
matches @samp{@@chapter} at the beginning of a string,
@@ -5592,8 +5592,8 @@ The condition is not true in the following example:
if ("line1\nLINE 2" ~ /^L/) @dots{}
@end example
address@hidden @code{$} (dollar sign), regexp operator
address@hidden dollar sign (@code{$}), regexp operator
address@hidden @code{$} (dollar sign) @subentry regexp operator
address@hidden dollar sign (@code{$}) @subentry regexp operator
@item @code{$}
This is similar to @samp{^}, but it matches only at the end of a string.
For example, @samp{p$}
@@ -5607,7 +5607,7 @@ The condition in the following example is not true:
if ("line1\nLINE 2" ~ /1$/) @dots{}
@end example
address@hidden @code{.} (period), regexp operator
address@hidden @code{.} (period) @subentry regexp operator
@cindex period (@code{.}), regexp operator
@item @code{.} (period)
This matches any single character,
@@ -5617,7 +5617,7 @@ concatenation, we can make a regular expression such as
@samp{U.A}, which
matches any three-character sequence that begins with @samp{U} and ends
with @samp{A}.
address@hidden POSIX @command{awk}, period (@code{.})@comma{} using
address@hidden POSIX @command{awk} @subentry period (@code{.}), using
In strict POSIX mode (@pxref{Options}),
@samp{.} does not match the @sc{nul}
character, which is a character with all bits equal to zero.
@@ -5627,9 +5627,9 @@ may not be able to match the @sc{nul} character.
@cindex @code{[]} (square brackets), regexp operator
@cindex square brackets (@code{[]}), regexp operator
@cindex bracket expressions
address@hidden character sets, See Also bracket expressions
address@hidden character lists, See bracket expressions
address@hidden character classes, See bracket expressions
address@hidden character sets @seealso{bracket expressions}
address@hidden character lists @seeentry{bracket expressions}
address@hidden character classes @seeentry{bracket expressions}
@item @address@hidden@code{]}
This is called a @dfn{bracket address@hidden other literature,
you may see a bracket expression referred to as either a
@@ -5641,7 +5641,7 @@ discussion of what can be inside the square brackets of a
bracket expression
is given in
@ref{Bracket Expressions}.
address@hidden bracket expressions, complemented
address@hidden bracket expressions @subentry complemented
@item @address@hidden@code{]}
This is a @dfn{complemented bracket expression}. The first character after
the @samp{[} @emph{must} be a @samp{^}. It matches any characters
@@ -5661,8 +5661,8 @@ a lowercase English vowel.
The alternation applies to the largest possible regexps on either side.
address@hidden @code{()} (parentheses), regexp operator
address@hidden parentheses @code{()}, regexp operator
address@hidden @code{()} (parentheses) @subentry regexp operator
address@hidden parentheses @code{()} @subentry regexp operator
@item @code{(address@hidden@code{)}
Parentheses are used for grouping in regular expressions, as in
arithmetic. They can be used to concatenate regular expressions
@@ -5672,8 +5672,8 @@ containing the alternation operator, @samp{|}. For
example,
(These are Texinfo formatting control sequences. The @samp{+} is
explained further on in this list.)
address@hidden @code{*} (asterisk), @code{*} operator, as regexp operator
address@hidden asterisk (@code{*}), @code{*} operator, as regexp operator
address@hidden @code{*} (asterisk) @subentry @code{*} operator @subentry as
regexp operator
address@hidden asterisk (@code{*}) @subentry @code{*} operator @subentry as
regexp operator
@item @code{*}
This symbol means that the preceding regular expression should be
repeated as many times as necessary to find a match. For example, @samp{ph*}
@@ -5691,16 +5691,16 @@ Second, @samp{*} finds as many repetitions as possible.
If the text
to be matched is @samp{phhhhhhhhhhhhhhooey}, @samp{ph*} matches all of
the @samp{h}s.
address@hidden @code{+} (plus sign), regexp operator
address@hidden plus sign (@code{+}), regexp operator
address@hidden @code{+} (plus sign) @subentry regexp operator
address@hidden plus sign (@code{+}) @subentry regexp operator
@item @code{+}
This symbol is similar to @samp{*}, except that the preceding expression must
be
matched at least once. This means that @samp{wh+y}
would match @samp{why} and @samp{whhy}, but not @samp{wy}, whereas
@samp{wh*y} would match all three.
address@hidden @code{?} (question mark), regexp operator
address@hidden question mark (@code{?}), regexp operator
address@hidden @code{?} (question mark) @subentry regexp operator
address@hidden question mark (@code{?}) @subentry regexp operator
@item @code{?}
This symbol is similar to @samp{*}, except that the preceding expression can be
matched either once or not at all. For example, @samp{fe?d}
@@ -5731,15 +5731,15 @@ Matches @samp{whhy}, @samp{whhhy}, and so on.
@end table
@cindex precedence, regexp operators
address@hidden regular expressions, operators, precedence of
address@hidden regular expressions @subentry operators @subentry precedence of
In regular expressions, the @samp{*}, @samp{+}, and @samp{?} operators,
as well as the braces @address@hidden and @address@hidden,
have
the highest precedence, followed by concatenation, and finally by @samp{|}.
As in arithmetic, parentheses can change how operators are grouped.
address@hidden POSIX @command{awk}, regular expressions and
address@hidden @command{gawk}, regular expressions, precedence
address@hidden POSIX @command{awk} @subentry regular expressions and
address@hidden @command{gawk} @subentry regular expressions @subentry precedence
In POSIX @command{awk} and @command{gawk}, the @samp{*}, @samp{+}, and
@samp{?} operators stand for themselves when there is nothing in the
regexp that precedes them. For example, @code{/+/} matches a literal
@@ -5749,12 +5749,12 @@ usage as a syntax error.
@node Interval Expressions
@subsection Some Notes On Interval Expressions
address@hidden POSIX @command{awk}, interval expressions in
address@hidden POSIX @command{awk} @subentry interval expressions in
Interval expressions were not traditionally available in @command{awk}.
They were added as part of the POSIX standard to make @command{awk}
and @command{egrep} consistent with each other.
address@hidden @command{gawk}, interval expressions and
address@hidden @command{gawk} @subentry interval expressions and
Initially, because old programs may use @address@hidden and @address@hidden in
regexp
constants,
@command{gawk} did @emph{not} match interval expressions
@@ -5787,7 +5787,7 @@ when in compatibility mode (@pxref{Options}).
@node Bracket Expressions
@section Using Bracket Expressions
@cindex bracket expressions
address@hidden bracket expressions, range expressions
address@hidden bracket expressions @subentry range expressions
@cindex range expressions (regexps)
@cindex character lists in regular expressions
@@ -5811,12 +5811,12 @@ the range 0--256). To match a range of characters
where the endpoints
of the range are larger than 256, enter the multibyte encodings of
the characters directly.
address@hidden @code{\} (backslash), in bracket expressions
address@hidden backslash (@code{\}), in bracket expressions
address@hidden @code{^} (caret), in bracket expressions
address@hidden caret (@code{^}), in bracket expressions
address@hidden @code{-} (hyphen), in bracket expressions
address@hidden hyphen (@code{-}), in bracket expressions
address@hidden @code{\} (backslash) @subentry in bracket expressions
address@hidden backslash (@code{\}) @subentry in bracket expressions
address@hidden @code{^} (caret) @subentry in bracket expressions
address@hidden caret (@code{^}) @subentry in bracket expressions
address@hidden @code{-} (hyphen) @subentry in bracket expressions
address@hidden hyphen (@code{-}) @subentry in bracket expressions
To include one of the characters @samp{\}, @samp{]}, @samp{-}, or @samp{^} in a
bracket expression, put a @samp{\} in front of it. For example:
@@ -5830,7 +5830,7 @@ Additionally, if you place @samp{]} right after the
opening
@samp{[}, the closing bracket is treated as one of the
characters to be matched.
address@hidden POSIX @command{awk}, bracket expressions and
address@hidden POSIX @command{awk} @subentry bracket expressions and
@cindex Extended Regular Expressions (EREs)
@cindex EREs (Extended Regular Expressions)
@cindex @command{egrep} utility
@@ -5842,8 +5842,8 @@ of the POSIX specification for Extended Regular
Expressions (EREs).
POSIX EREs are based on the regular expressions accepted by the
traditional @command{egrep} utility.
address@hidden bracket expressions, character classes
address@hidden POSIX @command{awk}, bracket expressions and, character classes
address@hidden bracket expressions @subentry character classes
address@hidden POSIX @command{awk} @subentry bracket expressions and @subentry
character classes
@dfn{Character classes} are a feature introduced in the POSIX standard.
A character class is a special notation for describing
lists of characters that have a specific attribute, but the
@@ -5925,8 +5925,8 @@ treat @code{[:blank:]} like @code{[:space:]}, incorrectly
matching
more characters than they should. Caveat Emptor.
@end quotation
address@hidden bracket expressions, collating elements
address@hidden bracket expressions, non-ASCII
address@hidden bracket expressions @subentry collating elements
address@hidden bracket expressions @subentry non-ASCII
@cindex collating elements
Two additional special sequences can appear in bracket expressions.
These apply to non-ASCII character sets, which can have single symbols
@@ -5937,7 +5937,7 @@ and a grave-accented address@hidden'' are equivalent.)
These sequences are:
@table @asis
address@hidden bracket expressions, collating symbols
address@hidden bracket expressions @subentry collating symbols
@cindex collating symbols
@item Collating symbols
Multicharacter collating elements enclosed between
@@ -5945,7 +5945,7 @@ Multicharacter collating elements enclosed between
then @samp{[[.ch.]]} is a regexp that matches this collating element, whereas
@samp{[ch]} is a regexp that matches either @samp{c} or @samp{h}.
address@hidden bracket expressions, equivalence classes
address@hidden bracket expressions @subentry equivalence classes
@item Equivalence classes
Locale-specific names for a list of
characters that are equal. The name is enclosed between
@@ -5957,9 +5957,9 @@ that matches any of @samp{e}, @address@hidden,
@samp{@'e}, or @address@hidden
These features are very valuable in non-English-speaking locales.
address@hidden internationalization, localization, character classes
address@hidden @command{gawk}, character classes and
address@hidden POSIX @command{awk}, bracket expressions and, character classes
address@hidden internationalization @subentry localization @subentry character
classes
address@hidden @command{gawk} @subentry character classes and
address@hidden POSIX @command{awk} @subentry bracket expressions and @subentry
character classes
@quotation CAUTION
The library functions that @command{gawk} uses for regular
expression matching currently recognize only POSIX character classes;
@@ -5974,7 +5974,7 @@ taken literally. This is also true of @samp{.} and
@samp{*}.
@node Leftmost Longest
@section How Much Text Matches?
address@hidden regular expressions, leftmost longest match
address@hidden regular expressions @subentry leftmost longest match
@c @cindex matching, leftmost longest
Consider the following:
@@ -6013,12 +6013,12 @@ and also @pxref{Field Separators}).
@node Computed Regexps
@section Using Dynamic Regexps
address@hidden regular expressions, computed
address@hidden regular expressions, dynamic
address@hidden @code{~} (tilde), @code{~} operator
address@hidden regular expressions @subentry computed
address@hidden regular expressions @subentry dynamic
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
@c @cindex operators, @code{~}
@c @cindex operators, @code{!~}
The righthand side of a @samp{~} or @samp{!~} operator need not be a
@@ -6049,11 +6049,11 @@ on the right. This is true of any string-valued
expression (such as
@code{digits_regexp}, shown in the previous example), not just string
constants.
@end quotation
address@hidden regexp constants, slashes vs.@: quotes
address@hidden @code{\} (backslash), in regexp constants
address@hidden backslash (@code{\}), in regexp constants
address@hidden @code{"} (double quote), in regexp constants
address@hidden double quote (@code{"}), in regexp constants
address@hidden regexp constants @subentry slashes vs.@: quotes
address@hidden @code{\} (backslash) @subentry in regexp constants
address@hidden backslash (@code{\}) @subentry in regexp constants
address@hidden @code{"} (double quote) @subentry in regexp constants
address@hidden double quote (@code{"}) @subentry in regexp constants
What difference does it make if the string is
scanned twice? The answer has to do with escape sequences, and particularly
with backslashes. To get a backslash into a regular expression inside a
@@ -6065,8 +6065,8 @@ you have to type @code{"\\*"}. The first backslash
escapes the
second one so that the string actually contains the
two characters @samp{\} and @samp{*}.
address@hidden troubleshooting, regexp constants vs.@: string constants
address@hidden regexp constants, vs.@: string constants
address@hidden troubleshooting @subentry regexp constants vs.@: string constants
address@hidden regexp constants @subentry vs.@: string constants
@cindex string constants, vs.@: regexp constants
Given that you can use both regexp and string constants to describe
regular expressions, which should you use? The answer is ``regexp
@@ -6091,14 +6091,14 @@ Using regexp constants is better form; it shows clearly
that you
intend a regexp match.
@end itemize
address@hidden sidebar, Using @code{\n} in Bracket Expressions of Dynamic
Regexps
address@hidden sidebar @subentry Using @code{\n} in Bracket Expressions of
Dynamic Regexps
@ifdocbook
@docbook
<sidebar><title>Using @code{\n} in Bracket Expressions of Dynamic
Regexps</title>
@end docbook
address@hidden regular expressions, dynamic, with embedded newlines
address@hidden newlines, in dynamic regexps
address@hidden regular expressions @subentry dynamic @subentry with embedded
newlines
address@hidden newlines @subentry in dynamic regexps
Some older versions of @command{awk} do not allow the newline
character to be used inside a bracket expression for a dynamic regexp:
@@ -6112,7 +6112,7 @@ $ @kbd{awk '$0 ~ "[ \t\n]"'}
@error{} $0 ~ "[ >>> \t\n]" <<<
@end example
address@hidden newlines, in regexp constants
address@hidden newlines @subentry in regexp constants
But a newline in a regexp constant works with no problem:
@example
@@ -6135,8 +6135,8 @@ occur often in practice, but it's worth noting for future
reference.
@center @b{Using @code{\n} in Bracket Expressions of Dynamic Regexps}
address@hidden regular expressions, dynamic, with embedded newlines
address@hidden newlines, in dynamic regexps
address@hidden regular expressions @subentry dynamic @subentry with embedded
newlines
address@hidden newlines @subentry in dynamic regexps
Some older versions of @command{awk} do not allow the newline
character to be used inside a bracket expression for a dynamic regexp:
@@ -6150,7 +6150,7 @@ $ @kbd{awk '$0 ~ "[ \t\n]"'}
@error{} $0 ~ "[ >>> \t\n]" <<<
@end example
address@hidden newlines, in regexp constants
address@hidden newlines @subentry in regexp constants
But a newline in a regexp constant works with no problem:
@example
@@ -6170,10 +6170,10 @@ occur often in practice, but it's worth noting for
future reference.
@c This section adapted (long ago) from the regex-0.12 manual
address@hidden regular expressions, operators, @command{gawk}
address@hidden @command{gawk}, regular expressions, operators
address@hidden operators, GNU-specific
address@hidden regular expressions, operators, for words
address@hidden regular expressions @subentry operators @subentry @command{gawk}
address@hidden @command{gawk} @subentry regular expressions @subentry operators
address@hidden operators @subentry GNU-specific
address@hidden regular expressions @subentry operators @subentry for words
@cindex word, regexp definition of
GNU software that deals with regular expressions provides a number of
additional regexp operators. These operators are described in this
@@ -6185,55 +6185,55 @@ or underscores (@samp{_}):
@table @code
@c @cindex operators, @code{\s} (@command{gawk})
address@hidden backslash (@code{\}), @code{\s} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\s} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\s} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\s} operator
(@command{gawk})
@item \s
Matches any whitespace character.
Think of it as shorthand for
@address@hidden:space:]]}}.
@c @cindex operators, @code{\S} (@command{gawk})
address@hidden backslash (@code{\}), @code{\S} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\S} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\S} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\S} operator
(@command{gawk})
@item \S
Matches any character that is not whitespace.
Think of it as shorthand for
@address@hidden:space:]]}}.
@c @cindex operators, @code{\w} (@command{gawk})
address@hidden backslash (@code{\}), @code{\w} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\w} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\w} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\w} operator
(@command{gawk})
@item \w
Matches any word-constituent character---that is, it matches any
letter, digit, or underscore. Think of it as shorthand for
@address@hidden:alnum:]_]}}.
@c @cindex operators, @code{\W} (@command{gawk})
address@hidden backslash (@code{\}), @code{\W} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\W} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\W} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\W} operator
(@command{gawk})
@item \W
Matches any character that is not word-constituent.
Think of it as shorthand for
@address@hidden:alnum:]_]}}.
@c @cindex operators, @code{\<} (@command{gawk})
address@hidden backslash (@code{\}), @code{\<} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\<} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\<} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\<} operator
(@command{gawk})
@item \<
Matches the empty string at the beginning of a word.
For example, @code{/\<away/} matches @samp{away} but not
@samp{stowaway}.
@c @cindex operators, @code{\>} (@command{gawk})
address@hidden backslash (@code{\}), @code{\>} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\>} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\>} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\>} operator
(@command{gawk})
@item \>
Matches the empty string at the end of a word.
For example, @code{/stow\>/} matches @samp{stow} but not @samp{stowaway}.
@c @cindex operators, @code{\y} (@command{gawk})
address@hidden backslash (@code{\}), @code{\y} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\y} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\y} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\y} operator
(@command{gawk})
@cindex word address@hidden matching
@item \y
Matches the empty string at either the beginning or the
@@ -6241,8 +6241,8 @@ end of a word (i.e., the word address@hidden). For
example, @samp{\yballs?\y
matches either @samp{ball} or @samp{balls}, as a separate word.
@c @cindex operators, @code{\B} (@command{gawk})
address@hidden backslash (@code{\}), @code{\B} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\B} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\B} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\B} operator
(@command{gawk})
@item \B
Matches the empty string that occurs between two
word-constituent characters. For example,
@@ -6250,9 +6250,9 @@ word-constituent characters. For example,
@samp{\B} is essentially the opposite of @samp{\y}.
@end table
address@hidden buffers, operators for
address@hidden regular expressions, operators, for buffers
address@hidden operators, string-matching, for buffers
address@hidden buffers @subentry operators for
address@hidden regular expressions @subentry operators @subentry for buffers
address@hidden operators @subentry string-matching @subentry for buffers
There are two other operators that work on buffers. In Emacs, a
@dfn{buffer} is, naturally, an Emacs buffer.
Other GNU programs, including @command{gawk},
@@ -6262,31 +6262,31 @@ The operators are:
@table @code
@item \`
@c @cindex operators, @code{\`} (@command{gawk})
address@hidden backslash (@code{\}), @code{\`} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\`} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\`} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\`} operator
(@command{gawk})
Matches the empty string at the
beginning of a buffer (string)
@c @cindex operators, @code{\'} (@command{gawk})
address@hidden backslash (@code{\}), @code{\'} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\'} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\'} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\'} operator
(@command{gawk})
@item \'
Matches the empty string at the
end of a buffer (string)
@end table
address@hidden @code{^} (caret), regexp operator
address@hidden caret (@code{^}), regexp operator
address@hidden @code{?} (question mark), regexp operator
address@hidden question mark (@code{?}), regexp operator
address@hidden @code{^} (caret) @subentry regexp operator
address@hidden caret (@code{^}) @subentry regexp operator
address@hidden @code{?} (question mark) @subentry regexp operator
address@hidden question mark (@code{?}) @subentry regexp operator
Because @samp{^} and @samp{$} always work in terms of the beginning
and end of strings, these operators don't add any new capabilities
for @command{awk}. They are provided for compatibility with other
GNU software.
address@hidden @command{gawk}, word-boundary operator
address@hidden @command{gawk} @subentry word-boundary operator
@cindex word-boundary operator (@command{gawk})
address@hidden operators, word-boundary (@command{gawk})
address@hidden operators @subentry word-boundary (@command{gawk})
In other GNU software, the word-boundary operator is @samp{\b}. However,
that conflicts with the @command{awk} language's definition of @samp{\b}
as backspace, so @command{gawk} uses a different letter.
@@ -6295,8 +6295,8 @@ GNU operators, but this was deemed too confusing. The
current
method of using @samp{\y} for the GNU @samp{\b} appears to be the
lesser of two evils.
address@hidden regular expressions, @command{gawk}, command-line options
address@hidden @command{gawk}, command-line options, and regular expressions
address@hidden regular expressions @subentry @command{gawk} @subentry
command-line options
address@hidden @command{gawk} @subentry command-line options @subentry and
regular expressions
The various command-line options
(@pxref{Options})
control how @command{gawk} interprets characters in regexps:
@@ -6339,8 +6339,8 @@ Otherwise, interval expressions are available by default.
@node Case-sensitivity
@section Case Sensitivity in Matching
address@hidden regular expressions, case sensitivity
address@hidden case sensitivity, regexps and
address@hidden regular expressions @subentry case sensitivity
address@hidden case sensitivity @subentry regexps and
Case is normally significant in regular expressions, both when matching
ordinary characters (i.e., not metacharacters) and inside bracket
expressions. Thus, a @samp{w} in a regular expression matches only a lowercase
@@ -6366,15 +6366,15 @@ tolower($1) ~ /foo/ @{ @dots{} @}
converts the first field to lowercase before matching against it.
This works in any POSIX-compliant @command{awk}.
address@hidden @command{gawk}, regular expressions, case sensitivity
address@hidden case sensitivity, @command{gawk}
address@hidden differences in @command{awk} and @command{gawk}, regular
expressions
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @command{gawk} @subentry regular expressions @subentry case
sensitivity
address@hidden case sensitivity @subentry @command{gawk}
address@hidden differences in @command{awk} and @command{gawk} @subentry
regular expressions
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{IGNORECASE} variable, with @code{~} and @code{!~} operators
address@hidden @command{gawk}, @code{IGNORECASE} variable in
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
address@hidden @code{IGNORECASE} variable @subentry with @code{~} and @code{!~}
operators
address@hidden @command{gawk} @subentry @code{IGNORECASE} variable in
@c @cindex variables, @code{IGNORECASE}
Another method, specific to @command{gawk}, is to set the variable
@code{IGNORECASE} to a nonzero value (@pxref{Built-in Variables}).
@@ -6482,7 +6482,7 @@ versions, use @code{tolower()} or @code{toupper()}.
@chapter Reading Input Files
@cindex reading input files
address@hidden input files, reading
address@hidden input files @subentry reading
@cindex input files
@cindex @code{FILENAME} variable
In the typical @command{awk} program,
@@ -6534,8 +6534,8 @@ used with it do not have to be named on the @command{awk}
command line
@node Records
@section How Input Is Split into Records
address@hidden input, splitting into records
address@hidden records, splitting input into
address@hidden input @subentry splitting into records
address@hidden records @subentry splitting input into
@cindex @code{NR} variable
@cindex @code{FNR} variable
@command{awk} divides the input for your program into records and fields.
@@ -6560,7 +6560,7 @@ This mechanism is explained in greater detail shortly.
@node awk split records
@subsection Record Splitting with Standard @command{awk}
address@hidden separators, for records
address@hidden separators @subentry for records
@cindex record separators
Records are separated by a character called the @dfn{record separator}.
By default, the record separator is the newline character.
@@ -6568,8 +6568,8 @@ This is why records are, by default, single lines.
To use a different character for the record separator,
simply assign that character to the predefined variable @code{RS}.
address@hidden record separators, newlines as
address@hidden newlines, as record separators
address@hidden record separators @subentry newlines as
address@hidden newlines @subentry as record separators
@cindex @code{RS} variable
Like any other variable,
the value of @code{RS} can be changed in the @command{awk} program
@@ -6661,8 +6661,8 @@ the newline separating them in the output
is the original newline in the @value{DF}, not the one added by
@command{awk} when it printed the record!
address@hidden record separators, changing
address@hidden separators, for records
address@hidden record separators @subentry changing
address@hidden separators @subentry for records
Another way to change the record separator is on the command line,
using the variable-assignment feature
(@pxref{Other Arguments}):
@@ -6703,14 +6703,14 @@ variable @code{NF} is the number of fields in the
current record.
printing @samp{0} as the result. Most other versions of @command{awk}
also act this way.)
address@hidden dark corner, input files
address@hidden dark corner @subentry input files
Reaching the end of an input file terminates the current input record,
even if the last character in the file is not the character in @code{RS}.
@value{DARKCORNER}
@cindex empty strings
@cindex null strings
address@hidden strings, empty, See null strings
address@hidden strings, empty @seeentry{null strings}
The empty string @code{""} (a string without any characters)
has a special meaning
as the value of @code{RS}. It means that records are separated
@@ -6722,15 +6722,15 @@ the new value is used to delimit subsequent records,
but the record
currently being processed, as well as records already processed, are not
affected.
address@hidden @command{gawk}, @code{RT} variable in
address@hidden @command{gawk} @subentry @code{RT} variable in
@cindex @code{RT} variable
address@hidden records, terminating
address@hidden records @subentry terminating
@cindex terminating records
address@hidden differences in @command{awk} and @command{gawk}, record
separators
address@hidden differences in @command{awk} and @command{gawk},
@code{RS}/@code{RT} variables
address@hidden regular expressions, as record separators
address@hidden record separators, regular expressions as
address@hidden separators, for records, regular expressions as
address@hidden differences in @command{awk} and @command{gawk} @subentry record
separators
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{RS}/@code{RT} variables
address@hidden regular expressions @subentry as record separators
address@hidden record separators @subentry regular expressions as
address@hidden separators @subentry for records @subentry regular expressions as
After the end of the record has been determined, @command{gawk}
sets the variable @code{RT} to the text in the input that matched
@code{RS}.
@@ -6738,8 +6738,8 @@ sets the variable @code{RT} to the text in the input that
matched
@node gawk split records
@subsection Record Splitting with @command{gawk}
address@hidden common extensions, @code{RS} as a regexp
address@hidden extensions, address@hidden @code{RS} as a regexp
address@hidden common extensions @subentry @code{RS} as a regexp
address@hidden extensions @subentry common, @code{RS} as a regexp
When using @command{gawk}, the value of @code{RS} is not limited to a
one-character string. If it contains more than one character, it is
treated as a regular expression
@@ -6803,9 +6803,9 @@ that happens to contain newline characters.
It is thus best to avoid anchor metacharacters in the value of @code{RS}.
@end quotation
address@hidden @command{gawk}, @code{RT} variable in
address@hidden @command{gawk} @subentry @code{RT} variable in
@cindex @code{RT} variable
address@hidden differences in @command{awk} and @command{gawk},
@code{RS}/@code{RT} variables
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{RS}/@code{RT} variables
The use of @code{RS} as a regular expression and the @code{RT}
variable are @command{gawk} extensions; they are not available in
compatibility mode
@@ -6813,13 +6813,13 @@ compatibility mode
In compatibility mode, only the first character of the value of
@code{RS} determines the end of the record.
address@hidden sidebar, @code{RS = "\0"} Is Not Portable
address@hidden sidebar @subentry @code{RS = "\0"} Is Not Portable
@ifdocbook
@docbook
<sidebar><title>@code{RS = "\0"} Is Not Portable</title>
@end docbook
address@hidden portability, data files as single record
address@hidden portability @subentry data files as single record
There are times when you might want to treat an entire @value{DF} as a
single record. The only way to make this happen is to give @code{RS}
a value that you know doesn't occur in the input file. This is hard
@@ -6834,7 +6834,7 @@ value to use for @code{RS} in this case:
BEGIN @{ RS = "\0" @} # whole file becomes one record?
@end example
address@hidden differences in @command{awk} and @command{gawk}, strings, storing
address@hidden differences in @command{awk} and @command{gawk} @subentry
strings @subentry storing
@command{gawk} in fact accepts this, and uses the @sc{nul}
character for the record separator.
This works for certain special files, such as @file{/proc/environ} on
@@ -6842,7 +6842,7 @@ GNU/Linux systems, where the @sc{nul} character is in
fact the record separator.
However, this usage is @emph{not} portable
to most other @command{awk} implementations.
address@hidden dark corner, strings, storing
address@hidden dark corner @subentry strings @subentry storing
Almost all other @command{awk} address@hidden least that we know
about.} store strings internally as C-style strings. C strings use the
@sc{nul} character as the string terminator. In effect, this means that
@@ -6854,7 +6854,7 @@ character as a record separator. However, this is a
special case:
@command{mawk} does not allow embedded @sc{nul} characters in strings.
(This may change in a future version of @command{mawk}.)
address@hidden records, treating files as
address@hidden records @subentry treating files as
@cindex treating files, as single records
@cindex single records, treating files as
@xref{Readfile Function} for an interesting way to read
@@ -6871,7 +6871,7 @@ Readfile} for another option.
@center @address@hidden = "\0"} Is Not Portable}
address@hidden portability, data files as single record
address@hidden portability @subentry data files as single record
There are times when you might want to treat an entire @value{DF} as a
single record. The only way to make this happen is to give @code{RS}
a value that you know doesn't occur in the input file. This is hard
@@ -6886,7 +6886,7 @@ value to use for @code{RS} in this case:
BEGIN @{ RS = "\0" @} # whole file becomes one record?
@end example
address@hidden differences in @command{awk} and @command{gawk}, strings, storing
address@hidden differences in @command{awk} and @command{gawk} @subentry
strings @subentry storing
@command{gawk} in fact accepts this, and uses the @sc{nul}
character for the record separator.
This works for certain special files, such as @file{/proc/environ} on
@@ -6894,7 +6894,7 @@ GNU/Linux systems, where the @sc{nul} character is in
fact the record separator.
However, this usage is @emph{not} portable
to most other @command{awk} implementations.
address@hidden dark corner, strings, storing
address@hidden dark corner @subentry strings @subentry storing
Almost all other @command{awk} address@hidden least that we know
about.} store strings internally as C-style strings. C strings use the
@sc{nul} character as the string terminator. In effect, this means that
@@ -6906,7 +6906,7 @@ character as a record separator. However, this is a
special case:
@command{mawk} does not allow embedded @sc{nul} characters in strings.
(This may change in a future version of @command{mawk}.)
address@hidden records, treating files as
address@hidden records @subentry treating files as
@cindex treating files, as single records
@cindex single records, treating files as
@xref{Readfile Function} for an interesting way to read
@@ -6921,7 +6921,7 @@ Readfile} for another option.
@cindex examining fields
@cindex fields
@cindex accessing fields
address@hidden fields, examining
address@hidden fields @subentry examining
When @command{awk} reads an input record, the record is
automatically @dfn{parsed} or separated by the @command{awk} utility into
chunks
called @dfn{fields}. By default, fields are separated by @dfn{whitespace},
@@ -6938,8 +6938,8 @@ operate on the whole record if you want---but fields are
what make
simple @command{awk} programs so powerful.
@cindex field operator @code{$}
address@hidden @code{$} (dollar sign), @code{$} field operator
address@hidden dollar sign (@code{$}), @code{$} field operator
address@hidden @code{$} (dollar sign) @subentry @code{$} field operator
address@hidden dollar sign (@code{$}) @subentry @code{$} field operator
@cindex field address@hidden dollar sign as
You use a dollar sign (@samp{$})
to refer to a field in an @command{awk} program,
@@ -6961,7 +6961,7 @@ Here the first field, or @code{$1}, is @samp{This}, the
second field, or
field.
@cindex @code{NF} variable
address@hidden fields, number of
address@hidden fields @subentry number of
@code{NF} is a predefined variable whose value is the number of fields
in the current record. @command{awk} automatically updates the value
of @code{NF} each time it reads a record. No matter how many fields
@@ -7000,7 +7000,7 @@ $ @kbd{awk '/li/ @{ print $1, $NF @}' mail-list}
@node Nonconstant Fields
@section Nonconstant Field Numbers
address@hidden fields, numbers
address@hidden fields @subentry numbers
@cindex field numbers
A field number need not be a constant. Any expression in
@@ -7057,7 +7057,7 @@ evaluating @code{NF} and using its value as a field
number.
@node Changing Fields
@section Changing the Contents of a Field
address@hidden fields, changing contents of
address@hidden fields @subentry changing contents of
The contents of a field, as seen by @command{awk}, can be changed within an
@command{awk} program; this changes what @command{awk} perceives as the
current input record. (The actual input is untouched; @command{awk}
@emph{never}
@@ -7117,8 +7117,8 @@ $ @kbd{awk '@{ $6 = ($5 + $4 + $3 + $2)}
@dots{}
@end example
address@hidden adding, fields
address@hidden fields, adding
address@hidden adding @subentry fields
address@hidden fields @subentry adding
@noindent
We've just created @code{$6}, whose value is the sum of fields
@code{$2}, @code{$3}, @code{$4}, and @code{$5}. The @samp{+} sign
@@ -7132,8 +7132,8 @@ the appropriate number of field separators between it and
the previously
existing fields.
@cindex @code{OFS} variable
address@hidden output field separator, See @code{OFS} variable
address@hidden field separators, See Also @code{OFS}
address@hidden output field separator @address@hidden variable}
address@hidden field separators @address@hidden
This recomputation affects and is affected by
@code{NF} (the number of fields; @pxref{Fields}).
For example, the value of @code{NF} is set to the number of the highest
@@ -7190,7 +7190,7 @@ The intervening field, @code{$5}, is created with an
empty value
(indicated by the second pair of adjacent colons),
and @code{NF} is updated with the value six.
address@hidden dark corner, @code{NF} variable, decrementing
address@hidden dark corner @subentry @code{NF} variable @subentry decrementing
@cindex @code{NF} variable, decrementing
Decrementing @code{NF} throws away the values of the fields
after the new value of @code{NF} and recomputes @code{$0}.
@@ -7204,7 +7204,7 @@ $ @kbd{echo a b c d e f | awk '@{ print "NF =", NF;}
@print{} a b c
@end example
address@hidden portability, @code{NF} address@hidden decrementing
address@hidden portability @subentry @code{NF} variable, decrementing
@quotation CAUTION
Some versions of @command{awk} don't
rebuild @code{$0} when @code{NF} is decremented.
@@ -7235,7 +7235,7 @@ This also applies to any built-in function that updates
@code{$0},
such as @code{sub()} and @code{gsub()}
(@pxref{String Functions}).
address@hidden sidebar, Understanding @code{$0}
address@hidden sidebar @subentry Understanding @code{$0}
@ifdocbook
@docbook
<sidebar><title>Understanding @code{$0}</title>
@@ -7297,9 +7297,9 @@ with a statement such as @samp{$1 = $1}, as described
earlier.
@end menu
@cindex @code{FS} variable
address@hidden fields, separating
address@hidden fields @subentry separating
@cindex field separators
address@hidden fields, separating
address@hidden fields @subentry separating
The @dfn{field separator}, which is either a single character or a regular
expression, controls the way @command{awk} splits an input record into fields.
@command{awk} scans the input record for character sequences that
@@ -7318,13 +7318,13 @@ is split into three fields: @samp{m}, @address@hidden,
and
@address@hidden@bullet{}pan}.
Note the leading spaces in the values of the second and third fields.
address@hidden troubleshooting, @command{awk} uses @code{FS} not @code{IFS}
address@hidden troubleshooting @subentry @command{awk} uses @code{FS} not
@code{IFS}
The field separator is represented by the predefined variable @code{FS}.
Shell programmers take note: @command{awk} does @emph{not} use the
name @code{IFS} that is used by the POSIX-compliant shells (such as
the Unix Bourne shell, @command{sh}, or Bash).
address@hidden @code{FS} variable, changing value of
address@hidden @code{FS} variable @subentry changing value of
The value of @code{FS} can be changed in the @command{awk} program with the
assignment operator, @samp{=} (@pxref{Assignment Ops}).
Often, the right time to do this is at the beginning of execution
@@ -7351,9 +7351,9 @@ John Q. Smith, 29 Oak St., Walamazoo, MI 42139
this @command{awk} program extracts and prints the string
@address@hidden@address@hidden
address@hidden field separators, choice of
address@hidden regular expressions, as field separators
address@hidden field separators, regular expressions as
address@hidden field separators @subentry choice of
address@hidden regular expressions @subentry as field separators
address@hidden field separators @subentry regular expressions as
Sometimes the input data contains separator characters that don't
separate fields the way you thought they would. For instance, the
person's name in the example we just used might have a title or
@@ -7376,8 +7376,8 @@ can massage it first with a separate @command{awk}
program.)
@node Default Field Splitting
@subsection Whitespace Normally Separates Fields
address@hidden field separators, whitespace as
address@hidden whitespace, as field separators
address@hidden field separators @subentry whitespace as
address@hidden whitespace @subentry as field separators
Fields are normally separated by whitespace sequences
(spaces, TABs, and newlines), not by single spaces. Two spaces in a row do not
delimit an empty field. The default value of the field separator @code{FS}
@@ -7398,8 +7398,8 @@ rules.
@node Regexp Field Splitting
@subsection Using Regular Expressions to Separate Fields
address@hidden regular expressions, as field separators
address@hidden field separators, regular expressions as
address@hidden regular expressions @subentry as field separators
address@hidden field separators @subentry regular expressions as
The previous @value{SUBSECTION}
discussed the use of single characters or simple strings as the
value of @code{FS}.
@@ -7454,8 +7454,8 @@ $ @kbd{echo ' a b c d ' | awk 'BEGIN @{ FS = "[
\t\n]+" @}}
@noindent
@cindex null strings
address@hidden strings, null
address@hidden empty strings, See null strings
address@hidden strings @subentry null
address@hidden empty strings @seeentry{null strings}
In this case, the first field is null, or empty.
The stripping of leading and trailing whitespace also comes into
@@ -7476,9 +7476,9 @@ Because the leading whitespace was ignored when finding
@code{$1},
it is not part of the new @code{$0}. Finally, the last @code{print}
statement prints the new @code{$0}.
address@hidden @code{FS}, containing @code{^}
address@hidden @code{^} (caret), in @code{FS}
address@hidden dark corner, @code{^}, in @code{FS}
address@hidden @code{FS} @subentry containing @code{^}
address@hidden @code{^} (caret) @subentry in @code{FS}
address@hidden dark corner @subentry @code{^} @subentry in @code{FS}
There is an additional subtlety to be aware of when using regular expressions
for field splitting.
It is not well specified in the POSIX standard, or anywhere else, what @samp{^}
@@ -7506,11 +7506,11 @@ $ @kbd{echo 'xxAA xxBxx C' |}
@node Single Character Fields
@subsection Making Each Character a Separate Field
address@hidden common extensions, single character fields
address@hidden extensions, address@hidden single character fields
address@hidden differences in @command{awk} and @command{gawk},
single-character fields
address@hidden common extensions @subentry single character fields
address@hidden extensions @subentry common, single character fields
address@hidden differences in @command{awk} and @command{gawk} @subentry
single-character fields
@cindex single-character fields
address@hidden fields, single-character
address@hidden fields @subentry single-character
There are times when you may want to examine each character
of a record separately. This can be done in @command{gawk} by
simply assigning the null string (@code{""}) to @code{FS}. @value{COMMONEXT}
@@ -7529,8 +7529,8 @@ $ @kbd{echo a b | gawk 'BEGIN @{ FS = "" @}}
@print{} Field 3 is b
@end example
address@hidden dark corner, @code{FS} as null string
address@hidden @code{FS} variable, as null string
address@hidden dark corner @subentry @code{FS} as null string
address@hidden @code{FS} variable @subentry as null string
Traditionally, the behavior of @code{FS} equal to @code{""} was not defined.
In this case, most versions of Unix @command{awk} simply treat the entire
record
as only having one field.
@@ -7542,10 +7542,10 @@ behaves this way.
@node Command Line Field Separator
@subsection Setting @code{FS} from the Command Line
address@hidden @option{-F} option, command-line
address@hidden field separator, on command line
address@hidden command line, @code{FS} address@hidden setting
address@hidden @code{FS} variable, setting from command line
address@hidden @option{-F} option @subentry command-line
address@hidden field separator @subentry on command line
address@hidden command line @subentry @code{FS} on, setting
address@hidden @code{FS} variable @subentry setting from command line
@code{FS} can be set on the command line. Use the @option{-F} option to
do so. For example:
@@ -7571,9 +7571,9 @@ awk -F\\\\ '@dots{}' files @dots{}
@end example
@noindent
address@hidden field separator, backslash (@code{\}) as
address@hidden @code{\} (backslash), as field separator
address@hidden backslash (@code{\}), as field separator
address@hidden field separator @subentry backslash (@code{\}) as
address@hidden @code{\} (backslash) @subentry as field separator
address@hidden backslash (@code{\}) @subentry as field separator
Because @samp{\} is used for quoting in the shell, @command{awk} sees
@samp{-F\\}. Then @command{awk} processes the @samp{\\} for escape
characters (@pxref{Escape Sequences}), finally yielding
@@ -7623,7 +7623,7 @@ separator, instead of the @samp{-} in the phone number
that was
originally intended. This demonstrates why you have to be careful in
choosing your field and record separators.
address@hidden Unix @command{awk}, password address@hidden field separators and
address@hidden Unix @command{awk} @subentry password files, field separators and
Perhaps the most common use of a single character as the field separator
occurs when processing the Unix system password file. On many Unix
systems, each user has a separate entry in the system password file, with one
@@ -7660,22 +7660,22 @@ awk -F'\n' '@var{program}' @var{files @dots{}}
@noindent
When you do this, @code{$1} is the same as @code{$0}.
address@hidden sidebar, Changing @code{FS} Does Not Affect the Fields
address@hidden sidebar @subentry Changing @code{FS} Does Not Affect the Fields
@ifdocbook
@docbook
<sidebar><title>Changing @code{FS} Does Not Affect the Fields</title>
@end docbook
address@hidden POSIX @command{awk}, field separators and
address@hidden field separator, POSIX and
address@hidden POSIX @command{awk} @subentry field separators and
address@hidden field separator @subentry POSIX and
According to the POSIX standard, @command{awk} is supposed to behave
as if each record is split into fields at the time it is read.
In particular, this means that if you change the value of @code{FS}
after a record is read, the values of the fields (i.e., how they were split)
should reflect the old value of @code{FS}, not the new one.
address@hidden dark corner, field separators
address@hidden dark corner @subentry field separators
@cindex @command{sed} utility
@cindex stream editors
However, many older implementations of @command{awk} do not work this way.
Instead,
@@ -7721,15 +7721,15 @@ command prints just the first line of
@file{/etc/passwd}.)
address@hidden POSIX @command{awk}, field separators and
address@hidden field separator, POSIX and
address@hidden POSIX @command{awk} @subentry field separators and
address@hidden field separator @subentry POSIX and
According to the POSIX standard, @command{awk} is supposed to behave
as if each record is split into fields at the time it is read.
In particular, this means that if you change the value of @code{FS}
after a record is read, the values of the fields (i.e., how they were split)
should reflect the old value of @code{FS}, not the new one.
address@hidden dark corner, field separators
address@hidden dark corner @subentry field separators
@cindex @command{sed} utility
@cindex stream editors
However, many older implementations of @command{awk} do not work this way.
Instead,
@@ -7802,7 +7802,7 @@ Each individual character in the record becomes a
separate field.
(This is a common extension; it is not specified by the POSIX standard.)
@end table
address@hidden sidebar, @code{FS} and @code{IGNORECASE}
address@hidden sidebar @subentry @code{FS} and @code{IGNORECASE}
@ifdocbook
@docbook
<sidebar><title>@code{FS} and @code{IGNORECASE}</title>
@@ -7866,7 +7866,7 @@ will take effect.
@cindex data, fixed-width
@cindex fixed-width data
address@hidden advanced features, fixed-width data
address@hidden advanced features @subentry fixed-width data
@c O'Reilly doesn't like it as a note the first thing in the section.
This @value{SECTION} discusses an advanced
@@ -7899,10 +7899,10 @@ on @code{FS} does not work well in this case. Although
a portable
@code{$0} (@pxref{String Functions}), this is awkward and inefficient
for a large number of fields.
address@hidden troubleshooting, fatal errors, field address@hidden specifying
address@hidden troubleshooting @subentry fatal errors @subentry field widths,
specifying
@cindex @command{w} utility
@cindex @code{FIELDWIDTHS} variable
address@hidden @command{gawk}, @code{FIELDWIDTHS} variable in
address@hidden @command{gawk} @subentry @code{FIELDWIDTHS} variable in
The splitting of an input record into fixed-width fields is specified by
assigning a string containing space-separated numbers to the built-in
variable @code{FIELDWIDTHS}. Each number specifies the width of the
@@ -8072,7 +8072,7 @@ This @value{SECTION} discusses an advanced
feature of @command{gawk}. If you are a novice @command{awk} user,
you might want to skip it on the first reading.
address@hidden advanced features, specifying field content
address@hidden advanced features @subentry specifying field content
Normally, when using @code{FS}, @command{gawk} defines the fields as the
parts of the record that occur in between each field separator. In other
words, @code{FS} defines what a field @emph{is not}, instead of what a field
@@ -8098,7 +8098,7 @@ Robbins,Arnold,"1234 A Pretty Street,
NE",MyTown,MyState,12345-6789,USA
@c endfile
@end example
address@hidden @command{gawk}, @code{FPAT} variable in
address@hidden @command{gawk} @subentry @code{FPAT} variable in
@cindex @code{FPAT} variable
The @code{FPAT} variable offers a solution for cases like this.
The value of @code{FPAT} should be a string that provides a regular expression.
@@ -8196,7 +8196,7 @@ available for splitting regular strings (@pxref{String
Functions}).
@node Testing field creation
@section Checking How @command{gawk} Is Splitting Records
address@hidden @command{gawk}, splitting fields and
address@hidden @command{gawk} @subentry splitting fields and
As we've seen, @command{gawk} provides three independent methods to split
input records into fields. The mechanism used is based on which of the
three address@hidden, @code{FIELDWIDTHS}, or @code{FPAT}---was
@@ -8235,15 +8235,15 @@ example of such a function).
@section Multiple-Line Records
@cindex multiple-line records
address@hidden records, multiline
address@hidden input, multiline records
address@hidden files, reading, multiline records
address@hidden input, files, See input files
address@hidden records @subentry multiline
address@hidden input @subentry multiline records
address@hidden files @subentry reading @subentry multiline records
address@hidden input, files @seeentry{input files}
In some databases, a single line cannot conveniently hold all the
information in one entry. In such cases, you can use multiline
records. The first step in doing this is to choose your data format.
address@hidden record separators, with multiline records
address@hidden record separators @subentry with multiline records
One technique is to use an unusual character or string to separate
records. For example, you could use the formfeed character (written
@samp{\f} in @command{awk}, as in C) to separate them, making each record
@@ -8264,7 +8264,7 @@ all act as one record separator.
whitespace do not count.)
@cindex leftmost longest match
address@hidden matching, leftmost longest
address@hidden matching @subentry leftmost longest
You can achieve the same effect as @samp{RS = ""} by assigning the
string @code{"\n\n+"} to @code{RS}. This regexp matches the newline
at the end of the record and one or more blank lines after the record.
@@ -8275,7 +8275,7 @@ So, the next record doesn't start until
the first nonblank line that follows---no matter how many blank lines
appear in a row, they are considered one record separator.
address@hidden dark corner, multiline records
address@hidden dark corner @subentry multiline records
However, there is an important difference between @samp{RS = ""} and
@samp{RS = "\n\n+"}. In the first case, leading newlines in the input
@value{DF} are ignored, and if a file ends without extra blank lines
@@ -8283,8 +8283,8 @@ after the last record, the final newline is removed from
the record.
In the second case, this special processing is not done.
@value{DARKCORNER}
address@hidden field separator, in multiline records
address@hidden @code{FS}, in multiline records
address@hidden field separator @subentry in multiline records
address@hidden @code{FS} @subentry in multiline records
Now that the input is separated into records, the second step is to
separate the fields in the records. One way to do this is to divide each
of the lines into fields in the normal manner. This happens by default
@@ -8397,9 +8397,9 @@ Leading and trailing matches of @var{regexp} delimit
empty records.
POSIX standard.)
@end table
address@hidden @command{gawk}, @code{RT} variable in
address@hidden @command{gawk} @subentry @code{RT} variable in
@cindex @code{RT} variable
address@hidden differences in @command{awk} and @command{gawk},
@code{RS}/@code{RT} variables
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{RS}/@code{RT} variables
If not in compatibility mode (@pxref{Options}), @command{gawk} sets
@code{RT} to the input text that matched the value specified by @code{RS}.
But if the input file ended without any text that matches @code{RS},
@@ -8408,8 +8408,8 @@ then @command{gawk} sets @code{RT} to the null string.
@node Getline
@section Explicit Input with @code{getline}
address@hidden @code{getline} command, explicit input with
address@hidden input, explicit
address@hidden @code{getline} command @subentry explicit input with
address@hidden input @subentry explicit
So far we have been getting our input data from @command{awk}'s main
input stream---either the standard input (usually your keyboard, sometimes
the output from another program) or the
@@ -8436,11 +8436,11 @@ Parts I and II
@end ifnotinfo
and have a good knowledge of how @command{awk} works.
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @code{ERRNO} variable, with @command{getline} command
address@hidden differences in @command{awk} and @command{gawk}, @code{getline}
command
address@hidden @code{getline} command, return values
address@hidden @option{--sandbox} option, input redirection with @code{getline}
address@hidden @command{gawk} @subentry @code{ERRNO} variable in
address@hidden @code{ERRNO} variable @subentry with @command{getline} command
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{getline} command
address@hidden @code{getline} command @subentry return values
address@hidden @option{--sandbox} option @subentry input redirection with
@code{getline}
The @code{getline} command returns 1 if it finds a record and 0 if
it encounters the end of the file. If there is some error in getting
@@ -8560,7 +8560,7 @@ rule in the program. @xref{Next Statement}.
@node Getline/Variable
@subsection Using @code{getline} into a Variable
@cindex @code{getline} into a variable
address@hidden variables, @code{getline} command address@hidden using
address@hidden variables @subentry @code{getline} command into, using
You can use @samp{getline @var{var}} to read the next record from
@command{awk}'s input into the variable @var{var}. No other processing is
@@ -8616,9 +8616,9 @@ the value of @code{NF} do not change.
@cindex @code{getline} from a file
@cindex input redirection
@cindex redirection of input
address@hidden @code{<} (left angle bracket), @code{<} operator (I/O)
address@hidden left angle bracket (@code{<}), @code{<} operator (I/O)
address@hidden operators, input/output
address@hidden @code{<} (left angle bracket) @subentry @code{<} operator (I/O)
address@hidden left angle bracket (@code{<}) @subentry @code{<} operator (I/O)
address@hidden operators @subentry input/output
Use @samp{getline < @var{file}} to read the next record from @var{file}.
Here, @var{file} is a string-valued expression that
specifies the @value{FN}. @samp{< @var{file}} is called a @dfn{redirection}
@@ -8644,7 +8644,7 @@ the normal manner, so the values of @code{$0} and the
other fields are
changed, resulting in a new value of @code{NF}.
@code{RT} is also set.
address@hidden POSIX @command{awk}, @code{<} operator and
address@hidden POSIX @command{awk} @subentry @code{<} operator and
@c Thanks to Paul Eggert for initial wording here
According to POSIX, @samp{getline < @var{expression}} is ambiguous if
@var{expression} contains unparenthesized operators other than
@@ -8655,7 +8655,7 @@ you want your program to be portable to all @command{awk}
implementations.
@node Getline/Variable/File
@subsection Using @code{getline} into a Variable from a File
address@hidden variables, @code{getline} command address@hidden using
address@hidden variables @subentry @code{getline} command into, using
Use @samp{getline @var{var} < @var{file}} to read input
from the file
@@ -8709,11 +8709,11 @@ Failing that, attention to details would be useful.}
@author Brian Kernighan
@end quotation
address@hidden @code{|} (vertical bar), @code{|} operator (I/O)
address@hidden vertical bar (@code{|}), @code{|} operator (I/O)
address@hidden @code{|} (vertical bar) @subentry @code{|} operator (I/O)
address@hidden vertical bar (@code{|}) @subentry @code{|} operator (I/O)
@cindex input pipeline
address@hidden pipe, input
address@hidden operators, input/output
address@hidden pipe @subentry input
address@hidden operators @subentry input/output
The output of a command can also be piped into @code{getline}, using
@address@hidden | getline}. In
this case, the string @var{command} is run as a shell command and its output
@@ -8783,7 +8783,7 @@ value of @code{NF}, and recomputes the value of
@code{$0}. The values of
@code{NR} and @code{FNR} are not changed.
@code{RT} is set.
address@hidden POSIX @command{awk}, @code{|} I/O operator and
address@hidden POSIX @command{awk} @subentry @code{|} I/O operator and
@c Thanks to Paul Eggert for initial wording here
According to POSIX, @address@hidden | getline} is ambiguous if
@var{expression} contains unparenthesized operators other than
@@ -8809,7 +8809,7 @@ have to worry.
@node Getline/Variable/Pipe
@subsection Using @code{getline} into a Variable from a Pipe
address@hidden variables, @code{getline} command address@hidden using
address@hidden variables @subentry @code{getline} command into, using
When you use @address@hidden | getline @var{var}}, the
output of @var{command} is sent through a pipe to
@@ -8841,12 +8841,12 @@ program to be portable to other @command{awk}
implementations.
@node Getline/Coprocess
@subsection Using @code{getline} from a Coprocess
address@hidden coprocesses, @code{getline} from
address@hidden @code{getline} command, address@hidden using from
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}), @code{|&} operator (I/O)
address@hidden operators, input/output
address@hidden differences in @command{awk} and @command{gawk}, input/output
operators
address@hidden coprocesses @subentry @code{getline} from
address@hidden @code{getline} command @subentry coprocesses, using from
address@hidden @code{|} (vertical bar) @subentry @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}) @subentry @code{|&} operator (I/O)
address@hidden operators @subentry input/output
address@hidden differences in @command{awk} and @command{gawk} @subentry
input/output operators
Reading input into @code{getline} from a pipe is a one-way operation.
The command that is started with @address@hidden | getline} only
@@ -8882,7 +8882,7 @@ where coprocesses are discussed in more detail.
@node Getline/Variable/Coprocess
@subsection Using @code{getline} into a Variable from a Coprocess
address@hidden variables, @code{getline} command address@hidden using
address@hidden variables @subentry @code{getline} command into, using
When you use @address@hidden |& getline @var{var}}, the output from
the coprocess @var{command} is sent through a two-way pipe to @code{getline}
@@ -8912,21 +8912,21 @@ When @code{getline} changes the value of @code{$0} and
@code{NF},
program and start testing the new record against every pattern.
However, the new record is tested against any subsequent rules.
address@hidden differences in @command{awk} and @command{gawk}, implementation
limitations
address@hidden implementation issues, @command{gawk}, limits
address@hidden @command{awk}, implementations, limits
address@hidden @command{gawk}, implementation issues, limits
address@hidden differences in @command{awk} and @command{gawk} @subentry
implementation limitations
address@hidden implementation issues @subentry @command{gawk} @subentry limits
address@hidden @command{awk} @subentry implementations @subentry limits
address@hidden @command{gawk} @subentry implementation issues @subentry limits
@item
Some very old @command{awk} implementations limit the number of pipelines that
an @command{awk}
program may have open to just one. In @command{gawk}, there is no such limit.
You can open as many pipelines (and coprocesses) as the underlying operating
system permits.
address@hidden side effects, @code{FILENAME} variable
address@hidden side effects @subentry @code{FILENAME} variable
@cindex @code{FILENAME} variable, @address@hidden setting with
address@hidden dark corner, @code{FILENAME} variable
address@hidden @code{getline} command, @code{FILENAME} variable and
address@hidden @code{BEGIN} pattern, @code{getline} and
address@hidden dark corner @subentry @code{FILENAME} variable
address@hidden @code{getline} command @subentry @code{FILENAME} variable and
address@hidden @code{BEGIN} pattern @subentry @code{getline} and
@item
An interesting side effect occurs if you use @code{getline} without a
redirection inside a @code{BEGIN} rule. Because an unredirected @code{getline}
@@ -8993,7 +8993,7 @@ know that there is a string value to be assigned.
@node Getline Summary
@subsection Summary of @code{getline} Variants
address@hidden @code{getline} command, variants
address@hidden @code{getline} command @subentry variants
@ref{table-getline-variants}
summarizes the eight variants of @code{getline},
@@ -9020,7 +9020,7 @@ Note: for each variant, @command{gawk} sets the @code{RT}
predefined variable.
@section Reading Input with a Timeout
@cindex timeout, reading input
address@hidden differences in @command{awk} and @command{gawk}, read timeouts
address@hidden differences in @command{awk} and @command{gawk} @subentry read
timeouts
This @value{SECTION} describes a feature that is specific to @command{gawk}.
You may specify a timeout in milliseconds for reading input from the keyboard,
@@ -9130,7 +9130,7 @@ indefinitely until some other process opens it for
writing.
@section Retrying Reads After Certain Input Errors
@cindex retrying input
address@hidden differences in @command{awk} and @command{gawk}, retrying input
address@hidden differences in @command{awk} and @command{gawk} @subentry
retrying input
This @value{SECTION} describes a feature that is specific to @command{gawk}.
When @command{gawk} encounters an error while reading input, by
@@ -9158,9 +9158,9 @@ descriptor has been configured to behave in a
non-blocking fashion.
@node Command-line directories
@section Directories on the Command Line
address@hidden differences in @command{awk} and @command{gawk}, command-line
directories
address@hidden directories, command-line
address@hidden command line, directories on
address@hidden differences in @command{awk} and @command{gawk} @subentry
command-line directories
address@hidden directories @subentry command-line
address@hidden command line @subentry directories on
According to the POSIX standard, files named on the @command{awk}
command line must be text files; it is a fatal error if they are not.
@@ -9283,7 +9283,7 @@ That can be fixed by making one simple change. What is it?
@chapter Printing Output
@cindex printing
address@hidden output, printing, See printing
address@hidden output, printing @seeentry{printing}
One of the most common programming actions is to @dfn{print}, or output,
some or all of the input. Use the @code{print} statement
for simple output, and the @code{printf} statement
@@ -9344,9 +9344,9 @@ The items to print can be constant strings or numbers,
fields of the
current record (such as @code{$1}), variables, or any @command{awk}
expression. Numeric values are converted to strings and then printed.
address@hidden records, printing
address@hidden lines, address@hidden printing
address@hidden text, printing
address@hidden records @subentry printing
address@hidden lines, blank, printing
address@hidden text @subentry printing
The simple statement @samp{print} with no items is equivalent to
@samp{print $0}: it prints the entire current record. To print a blank
line, use @samp{print ""}.
@@ -9368,7 +9368,7 @@ isn't limited to only one line. If an item value is a
string containing a
newline, the newline is output along with the rest of the string. A
single @code{print} statement can make any number of lines this way.
address@hidden newlines, printing
address@hidden newlines @subentry printing
The following is an example of printing a string that contains embedded
@ifinfo
newlines
@@ -9395,7 +9395,7 @@ $ @kbd{awk 'BEGIN @{ print "line one\nline two\nline
three" @}'}
@end group
@end example
address@hidden fields, printing
address@hidden fields @subentry printing
The next example, which is run on the @file{inventory-shipped} file,
prints the first two fields of each input record, with a space between
them:
@@ -9408,8 +9408,8 @@ $ @kbd{awk '@{ print $1, $2 @}' inventory-shipped}
@dots{}
@end example
address@hidden @code{print} statement, commas, omitting
address@hidden troubleshooting, @code{print} address@hidden omitting commas
address@hidden @code{print} statement @subentry commas @subentry omitting
address@hidden troubleshooting @subentry @code{print} statement, omitting commas
A common mistake in using the @code{print} statement is to omit the comma
between two items. This often has the effect of making the items run
together in the output, with no space. The reason for this is that
@@ -9424,7 +9424,7 @@ $ @kbd{awk '@{ print $1 $2 @}' inventory-shipped}
@dots{}
@end example
address@hidden @code{BEGIN} pattern, address@hidden adding
address@hidden @code{BEGIN} pattern @subentry headings, adding
To someone unfamiliar with the @file{inventory-shipped} file, neither
example's output makes much sense. A heading line at the beginning
would make it clearer. Let's add some headings to our table of months
@@ -9463,8 +9463,8 @@ awk 'BEGIN @{ print "Month Crates"
@end group
@end example
address@hidden @code{printf} statement, address@hidden aligning
address@hidden columns, aligning
address@hidden @code{printf} statement @subentry columns, aligning
address@hidden columns @subentry aligning
Lining up columns this way can get pretty
complicated when there are many columns to fix. Counting spaces for two
or three columns is simple, but any more than this can take up
@@ -9472,8 +9472,8 @@ a lot of time. This is why the @code{printf} statement was
created (@pxref{Printf});
one of its specialties is lining up columns of data.
address@hidden line continuations, in @code{print} statement
address@hidden @code{print} statement, line continuations and
address@hidden line continuations @subentry in @code{print} statement
address@hidden @code{print} statement @subentry line continuations and
@quotation NOTE
You can continue either a @code{print} or
@code{printf} statement simply by putting a newline after any comma
@@ -9499,10 +9499,10 @@ then outputs a string called the @dfn{output record
separator} (or
(i.e., a newline character). Thus, each @code{print} statement normally
makes a separate line.
address@hidden output, records
address@hidden output record separator, See @code{ORS} variable
address@hidden output @subentry records
address@hidden output record separator @address@hidden variable}
@cindex @code{ORS} variable
address@hidden @code{BEGIN} pattern, @code{OFS}/@code{ORS} variables, assigning
values to
address@hidden @code{BEGIN} pattern @subentry @code{OFS}/@code{ORS} variables
@subentry assigning values to
In order to change how output fields and records are separated, assign
new values to the variables @code{OFS} and @code{ORS}. The usual
place to do this is in the @code{BEGIN} rule
@@ -9548,7 +9548,7 @@ runs together on a single line.
@node OFMT
@section Controlling Numeric Output with @code{print}
address@hidden numeric, output format
address@hidden numeric @subentry output format
@cindex address@hidden numeric output
When printing numeric values with the @code{print} statement,
@command{awk} internally converts each number to a string of characters
@@ -9564,7 +9564,7 @@ more fully in
@cindexawkfunc{sprintf}
@cindex @code{OFMT} variable
address@hidden output, format address@hidden @code{OFMT}
address@hidden output @subentry format specifier, @code{OFMT}
The predefined variable @code{OFMT} contains the format specification
that @code{print} uses with @code{sprintf()} when it wants to convert a
number to a string for printing.
@@ -9581,8 +9581,8 @@ $ @kbd{awk 'BEGIN @{}
@end example
@noindent
address@hidden dark corner, @code{OFMT} variable
address@hidden POSIX @command{awk}, @code{OFMT} variable and
address@hidden dark corner @subentry @code{OFMT} variable
address@hidden POSIX @command{awk} @subentry @code{OFMT} variable and
@cindex @code{OFMT} variable, POSIX @command{awk} and
According to the POSIX standard, @command{awk}'s behavior is undefined
if @code{OFMT} contains anything but a floating-point conversion specification.
@@ -9592,7 +9592,7 @@ if @code{OFMT} contains anything but a floating-point
conversion specification.
@section Using @code{printf} Statements for Fancier Printing
@cindex @code{printf} statement
address@hidden output, formatted
address@hidden output @subentry formatted
@cindex formatting output
For more precise control over the output format than what is
provided by @code{print}, use @code{printf}.
@@ -9612,7 +9612,7 @@ after the decimal point).
@node Basic Printf
@subsection Introduction to the @code{printf} Statement
address@hidden @code{printf} statement, syntax of
address@hidden @code{printf} statement @subentry syntax of
A simple @code{printf} statement looks like this:
@example
@@ -9660,8 +9660,8 @@ the output message.
@node Control Letters
@subsection Format-Control Letters
address@hidden @code{printf} statement, format-control characters
address@hidden format specifiers, @code{printf} statement
address@hidden @code{printf} statement @subentry format-control characters
address@hidden format specifiers @subentry @code{printf} statement
A format specifier starts with the character @samp{%} and ends with
a @dfn{format-control letter}---it tells the @code{printf} statement
@@ -9696,8 +9696,8 @@ Print a number as a character; thus, @samp{printf "%c",
65} outputs the letter @samp{A}. The output for a string value is
the first character of the string.
address@hidden dark corner, format-control characters
address@hidden @command{gawk}, format-control characters
address@hidden dark corner @subentry format-control characters
address@hidden @command{gawk} @subentry format-control characters
@quotation NOTE
The POSIX standard says the first character of a string is printed.
In locales with multibyte characters, @command{gawk} attempts to
@@ -9795,8 +9795,8 @@ This does not consume an
argument and it ignores any modifiers.
@end table
address@hidden dark corner, format-control characters
address@hidden @command{gawk}, format-control characters
address@hidden dark corner @subentry format-control characters
address@hidden @command{gawk} @subentry format-control characters
@quotation NOTE
When using the integer format-control letters for values that are
outside the range of the widest C integer type, @command{gawk} switches to
@@ -9821,7 +9821,7 @@ the IEEE standard. Further details are provided in
@node Format Modifiers
@subsection Modifiers for @code{printf} Formats
address@hidden @code{printf} statement, modifiers
address@hidden @code{printf} statement @subentry modifiers
@cindex address@hidden in format specifiers
A format specification can also include @dfn{modifiers} that can control
how much of the item's value is printed, as well as how much space it gets.
@@ -9832,10 +9832,10 @@ spaces in the output. Here are the possible modifiers,
in the order in
which they may appear:
@table @asis
address@hidden differences in @command{awk} and @command{gawk},
@code{print}/@code{printf} statements
address@hidden @code{printf} statement, positional specifiers
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{print}/@code{printf} statements
address@hidden @code{printf} statement @subentry positional specifiers
@c the code{} does NOT start a secondary
address@hidden positional specifiers, @code{printf} statement
address@hidden positional specifiers @subentry @code{printf} statement
@item @address@hidden
An integer constant followed by a @samp{$} is a @dfn{positional specifier}.
Normally, format specifications are applied to arguments in the order
@@ -10018,8 +10018,8 @@ printf "%" w "." p "s\n", s
This is not particularly easy to read, but it does work.
@c @cindex lint checks
address@hidden troubleshooting, fatal errors, @code{printf} format strings
address@hidden POSIX @command{awk}, @code{printf} format strings and
address@hidden troubleshooting @subentry fatal errors @subentry @code{printf}
format strings
address@hidden POSIX @command{awk} @subentry @code{printf} format strings and
C programmers may be used to supplying additional modifiers (@samp{h},
@samp{j}, @samp{l}, @samp{L}, @samp{t}, and @samp{z}) in @code{printf}
format strings. These are not valid in @command{awk}. Most @command{awk}
@@ -10112,7 +10112,7 @@ awk 'BEGIN @{ format = "%-10s %s\n"
@cindex output redirection
@cindex redirection of output
address@hidden @option{--sandbox} option, output redirection with @code{print},
@code{printf}
address@hidden @option{--sandbox} option @subentry output redirection with
@code{print} @subentry @code{printf}
So far, the output from @code{print} and @code{printf} has gone
to the standard
output, usually the screen. Both @code{print} and @code{printf} can
@@ -10129,17 +10129,17 @@ Redirections in @command{awk} are written just like
redirections in shell
commands, except that they are written inside the @command{awk} program.
@c the commas here are part of the see also
address@hidden @code{print} statement, See Also address@hidden of output
address@hidden @code{printf} statement, See Also address@hidden of output
address@hidden @code{print} statement @address@hidden of output}
address@hidden @code{printf} statement @address@hidden of output}
There are four forms of output redirection: output to a file, output
appended to a file, output through a pipe to another command, and output
to a coprocess. We show them all for the @code{print} statement,
but they work identically for @code{printf}:
@table @code
address@hidden @code{>} (right angle bracket), @code{>} operator (I/O)
address@hidden right angle bracket (@code{>}), @code{>} operator (I/O)
address@hidden operators, input/output
address@hidden @code{>} (right angle bracket) @subentry @code{>} operator (I/O)
address@hidden right angle bracket (@code{>}) @subentry @code{>} operator (I/O)
address@hidden operators @subentry input/output
@item print @var{items} > @var{output-file}
This redirection prints the items into the output file named
@var{output-file}. The @value{FN} @var{output-file} can be any
@@ -10171,8 +10171,8 @@ $ @kbd{cat name-list}
@noindent
Each output file contains one name or number per line.
address@hidden @code{>} (right angle bracket), @code{>>} operator (I/O)
address@hidden right angle bracket (@code{>}), @code{>>} operator (I/O)
address@hidden @code{>} (right angle bracket) @subentry @code{>>} operator (I/O)
address@hidden right angle bracket (@code{>}) @subentry @code{>>} operator (I/O)
@item print @var{items} >> @var{output-file}
This redirection prints the items into the preexisting output file
named @var{output-file}. The difference between this and the
@@ -10181,9 +10181,9 @@ address@hidden>} redirection is that the old contents
(if any) of
appended to the file.
If @var{output-file} does not exist, then it is created.
address@hidden @code{|} (vertical bar), @code{|} operator (I/O)
address@hidden pipe, output
address@hidden output, pipes
address@hidden @code{|} (vertical bar) @subentry @code{|} operator (I/O)
address@hidden pipe @subentry output
address@hidden output @subentry pipes
@item print @var{items} | @var{command}
It is possible to send output to another program through a pipe
instead of into a file. This redirection opens a pipe to
@@ -10238,9 +10238,9 @@ because (if you mean to refer to that same file or
command)
every time.
@cindex coprocesses
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O)
address@hidden operators, input/output
address@hidden differences in @command{awk} and @command{gawk}, input/output
operators
address@hidden @code{|} (vertical bar) @subentry @code{|&} operator (I/O)
address@hidden operators @subentry input/output
address@hidden differences in @command{awk} and @command{gawk} @subentry
input/output operators
@item print @var{items} |& @var{command}
This redirection prints the items to the input of @var{command}.
The difference between this and the
@@ -10270,7 +10270,7 @@ asks the system to open a file, pipe, or coprocess only
if the particular
@var{file} or @var{command} you specify has not already been written
to by your program or if it has been closed since it was last written to.
address@hidden troubleshooting, printing
address@hidden troubleshooting @subentry printing
It is a common error to use @samp{>} redirection for the first @code{print}
to a file, and then to use @samp{>>} for subsequent output:
@@ -10291,10 +10291,10 @@ output is produced in the expected order. However,
mixing the operators
for the same file is definitely poor style, and is confusing to readers
of your program.)
address@hidden differences in @command{awk} and @command{gawk}, implementation
limitations
address@hidden implementation issues, @command{gawk}, limits
address@hidden @command{awk}, implementation issues, pipes
address@hidden @command{gawk}, implementation issues, pipes
address@hidden differences in @command{awk} and @command{gawk} @subentry
implementation limitations
address@hidden implementation issues @subentry @command{gawk} @subentry limits
address@hidden @command{awk} @subentry implementation issues @subentry pipes
address@hidden @command{gawk} @subentry implementation issues @subentry pipes
@ifnotinfo
As mentioned earlier
(@pxref{Getline Notes}),
@@ -10311,13 +10311,13 @@ program may have open to just one! In
@command{gawk}, there is no such limit.
@command{gawk} allows a program to
open as many pipelines as the underlying operating system permits.
address@hidden sidebar, Piping into @command{sh}
address@hidden sidebar @subentry Piping into @command{sh}
@ifdocbook
@docbook
<sidebar><title>Piping into @command{sh}</title>
@end docbook
address@hidden shells, piping commands into
address@hidden shells @subentry piping commands into
A particularly powerful way to use redirection is to build command lines
and pipe them into the shell, @command{sh}. For example, suppose you
@@ -10352,7 +10352,7 @@ command lines to be fed to the shell.
@center @b{Piping into @command{sh}}
address@hidden shells, piping commands into
address@hidden shells @subentry piping commands into
A particularly powerful way to use redirection is to build command lines
and pipe them into the shell, @command{sh}. For example, suppose you
@@ -10382,13 +10382,13 @@ command lines to be fed to the shell.
@node Special FD
@section Special Files for Standard Preopened Data Streams
@cindex standard input
address@hidden input, standard
address@hidden input @subentry standard
@cindex standard output
address@hidden output, standard
address@hidden output @subentry standard
@cindex error output
@cindex standard error
@cindex file descriptors
address@hidden files, descriptors, See file descriptors
address@hidden files, descriptors @seeentry{file descriptors}
Running programs conventionally have three input and output streams
already available to them for reading and writing. These are known
@@ -10403,7 +10403,7 @@ is typically used for writing error messages; the
reason there are two separate
streams, standard output and standard error, is so that they can be
redirected separately.
address@hidden differences in @command{awk} and @command{gawk}, error messages
address@hidden differences in @command{awk} and @command{gawk} @subentry error
messages
@cindex error handling
In traditional implementations of @command{awk}, the only way to write an error
message to standard error in an @command{awk} program is as follows:
@@ -10446,15 +10446,15 @@ the descriptor that the @value{FN} stands for. These
special
@value{FN}s work for all operating systems that @command{gawk}
has been ported to, not just those that are POSIX-compliant:
address@hidden common extensions, @code{/dev/stdin} special file
address@hidden common extensions, @code{/dev/stdout} special file
address@hidden common extensions, @code{/dev/stderr} special file
address@hidden extensions, address@hidden @code{/dev/stdin} special file
address@hidden extensions, address@hidden @code{/dev/stdout} special file
address@hidden extensions, address@hidden @code{/dev/stderr} special file
address@hidden file names, standard streams in @command{gawk}
address@hidden common extensions @subentry @code{/dev/stdin} special file
address@hidden common extensions @subentry @code{/dev/stdout} special file
address@hidden common extensions @subentry @code{/dev/stderr} special file
address@hidden extensions @subentry common, @code{/dev/stdin} special file
address@hidden extensions @subentry common, @code{/dev/stdout} special file
address@hidden extensions @subentry common, @code{/dev/stderr} special file
address@hidden file names @subentry standard streams in @command{gawk}
@cindex @code{/dev/@dots{}} special files
address@hidden files, @code{/dev/@dots{}} special files
address@hidden files @subentry @code{/dev/@dots{}} special files
@cindex @code{/dev/fd/@var{N}} special files (@command{gawk})
@table @file
@item /dev/stdin
@@ -10474,7 +10474,7 @@ the proper way to write an error message then becomes:
print "Serious error detected!" > "/dev/stderr"
@end example
address@hidden troubleshooting, quotes with file names
address@hidden troubleshooting @subentry quotes with file names
Note the use of quotes around the @value{FN}.
Like with any other redirection, the value must be a string.
It is a common error to omit the quotes, which leads
@@ -10487,7 +10487,7 @@ invoked with the @option{--traditional} option
(@pxref{Options}).
@node Special Files
@section Special @value{FFN}s in @command{gawk}
address@hidden @command{gawk}, file names in
address@hidden @command{gawk} @subentry file names in
Besides access to standard input, standard output, and standard error,
@command{gawk} provides access to any open file descriptor.
@@ -10526,7 +10526,7 @@ above two, does actually close the given file
descriptor.
@node Special Network
@subsection Special Files for Network Communications
address@hidden networks, support for
address@hidden networks @subentry support for
@cindex TCP/IP, support for
@command{gawk} programs
@@ -10556,8 +10556,8 @@ Here are some things to bear in mind when using the
special @value{FN}s that @command{gawk} provides:
@itemize @value{BULLET}
address@hidden compatibility mode (@command{gawk}), file names
address@hidden file names, in compatibility mode
address@hidden compatibility mode (@command{gawk}) @subentry file names
address@hidden file names @subentry in compatibility mode
@item
Recognition of the @value{FN}s for the three standard preopened
files is disabled only in POSIX mode.
@@ -10580,12 +10580,12 @@ Doing so results in unpredictable behavior.
@node Close Files And Pipes
@section Closing Input and Output Redirections
address@hidden files, output, See output files
address@hidden input files, closing
address@hidden output, address@hidden closing
address@hidden pipe, closing
address@hidden coprocesses, closing
address@hidden @code{getline} command, address@hidden using from
address@hidden files, output @seeentry{output files}
address@hidden input files @subentry closing
address@hidden output @subentry files, closing
address@hidden pipe @subentry closing
address@hidden coprocesses @subentry closing
address@hidden @code{getline} command @subentry coprocesses, using from
If the same @value{FN} or the same shell command is used with @code{getline}
more than once during the execution of an @command{awk} program
@@ -10687,9 +10687,9 @@ program closes the pipe after each line of output, then
each line makes
a separate message.
@end itemize
address@hidden differences in @command{awk} and @command{gawk}, @code{close()}
function
address@hidden portability, @code{close()} function and
address@hidden @code{close()} function, portability
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{close()} function
address@hidden portability @subentry @code{close()} function and
address@hidden @code{close()} function @subentry portability
If you use more files than the system allows you to have open,
@command{gawk} attempts to multiplex the available open files among
your @value{DF}s. @command{gawk}'s ability to do this depends upon the
@@ -10737,7 +10737,7 @@ It is, more likely, a close of a file that was never
opened with a
redirection, so @command{awk} silently does nothing, except return
a negative value.
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O),
address@hidden closing
address@hidden @code{|} (vertical bar) @subentry @code{|&} operator (I/O)
@subentry pipes, closing
When using the @samp{|&} operator to communicate with a coprocess,
it is occasionally useful to be able to close one end of the two-way
pipe without closing the other.
@@ -10752,17 +10752,17 @@ delayed until
@ref{Two-way I/O},
which describes it in more detail and gives an example.
address@hidden sidebar, Using @code{close()}'s Return Value
address@hidden sidebar @subentry Using @code{close()}'s Return Value
@ifdocbook
@docbook
<sidebar><title>Using @code{close()}'s Return Value</title>
@end docbook
address@hidden dark corner, @code{close()} function
address@hidden @code{close()} function, return value
address@hidden dark corner @subentry @code{close()} function
address@hidden @code{close()} function @subentry return value
@cindex return address@hidden @code{close()} function
address@hidden differences in @command{awk} and @command{gawk}, @code{close()}
function
address@hidden Unix @command{awk}, @code{close()} function and
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{close()} function
address@hidden Unix @command{awk} @subentry @code{close()} function and
In many older versions of Unix @command{awk}, the @code{close()} function
is actually a statement.
@@ -10776,8 +10776,8 @@ command | getline info
retval = close(command) # syntax error in many Unix awks
@end example
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @code{ERRNO} variable, with @command{close()} function
address@hidden @command{gawk} @subentry @code{ERRNO} variable in
address@hidden @code{ERRNO} variable @subentry with @command{close()} function
@command{gawk} treats @code{close()} as a function.
The return value is @minus{}1 if the argument names something
that was never opened with a redirection, or if there is
@@ -10824,11 +10824,11 @@ when closing a pipe.
@center @b{Using @code{close()}'s Return Value}
address@hidden dark corner, @code{close()} function
address@hidden @code{close()} function, return value
address@hidden dark corner @subentry @code{close()} function
address@hidden @code{close()} function @subentry return value
@cindex return address@hidden @code{close()} function
address@hidden differences in @command{awk} and @command{gawk}, @code{close()}
function
address@hidden Unix @command{awk}, @code{close()} function and
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{close()} function
address@hidden Unix @command{awk} @subentry @code{close()} function and
In many older versions of Unix @command{awk}, the @code{close()} function
is actually a statement.
@@ -10842,8 +10842,8 @@ command | getline info
retval = close(command) # syntax error in many Unix awks
@end example
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @code{ERRNO} variable, with @command{close()} function
address@hidden @command{gawk} @subentry @code{ERRNO} variable in
address@hidden @code{ERRNO} variable @subentry with @command{close()} function
@command{gawk} treats @code{close()} as a function.
The return value is @minus{}1 if the argument names something
that was never opened with a redirection, or if there is
@@ -11061,7 +11061,7 @@ that provide the values used in expressions.
@node Constants
@subsection Constant Expressions
address@hidden constants, types of
address@hidden constants @subentry types of
The simplest type of expression is the @dfn{constant}, which always has
the same value. There are three types of constants: numeric,
@@ -11080,7 +11080,7 @@ have different forms, but are internally stored in an
identical manner.
@node Scalar Constants
@subsubsection Numeric and String Constants
address@hidden constants, numeric
address@hidden constants @subentry numeric
@cindex numeric constants
A @dfn{numeric constant} stands for a number. This number can be an
integer, a decimal fraction, or a number in scientific (exponential)
@@ -11106,8 +11106,8 @@ double quotation marks. For example:
@end example
@noindent
address@hidden differences in @command{awk} and @command{gawk}, strings
address@hidden strings, length limitations
address@hidden differences in @command{awk} and @command{gawk} @subentry strings
address@hidden strings @subentry length limitations
represents the string whose contents are @samp{parrot}. Strings in
@command{gawk} can be of any length, and they can contain any of the possible
eight-bit ASCII characters, including ASCII @sc{nul} (character code zero).
@@ -11146,9 +11146,9 @@ $ @kbd{gawk 'BEGIN @{ print "hello, }
@print{} gawk: cmd. line:1: ^ syntax error
@end example
address@hidden dark corner, string continuation
address@hidden strings, continuation across lines
address@hidden differences in @command{awk} and @command{gawk}, strings
address@hidden dark corner @subentry string continuation
address@hidden strings @subentry continuation across lines
address@hidden differences in @command{awk} and @command{gawk} @subentry strings
Although POSIX doesn't define what happens if you use an escaped
newline, as in the previous C example, all known versions of
@command{awk} allow you to do so. Unfortunately, what each one
@@ -11180,8 +11180,8 @@ $ @kbd{nawk 'BEGIN @{ print "hello, \}
@subsubsection Octal and Hexadecimal Numbers
@cindex octal numbers
@cindex hexadecimal numbers
address@hidden numbers, octal
address@hidden numbers, hexadecimal
address@hidden numbers @subentry octal
address@hidden numbers @subentry hexadecimal
In @command{awk}, all numbers are in decimal (i.e., base 10). Many other
programming languages allow you to specify numbers in other bases, often
@@ -11226,8 +11226,8 @@ Being able to use octal and hexadecimal constants in
your programs is most
useful when working with data that cannot be represented conveniently as
characters or as regular numbers, such as binary data of various sorts.
address@hidden @command{gawk}, octal numbers and
address@hidden @command{gawk}, hexadecimal numbers and
address@hidden @command{gawk} @subentry octal numbers and
address@hidden @command{gawk} @subentry hexadecimal numbers and
@command{gawk} allows the use of octal and hexadecimal
constants in your program text. However, such numbers in the input data
are not treated differently; doing so by default would break old
@@ -11254,14 +11254,14 @@ $ @kbd{gawk 'BEGIN @{ print "021 is", 021 ; print 018
@}'}
@print{} 18
@end example
address@hidden compatibility mode (@command{gawk}), octal numbers
address@hidden compatibility mode (@command{gawk}), hexadecimal numbers
address@hidden compatibility mode (@command{gawk}) @subentry octal numbers
address@hidden compatibility mode (@command{gawk}) @subentry hexadecimal numbers
Octal and hexadecimal source code constants are a @command{gawk} extension.
If @command{gawk} is in compatibility mode
(@pxref{Options}),
they are not available.
address@hidden sidebar, A Constant's Base Does Not Affect Its Value
address@hidden sidebar @subentry A Constant's Base Does Not Affect Its Value
@ifdocbook
@docbook
<sidebar><title>A Constant's Base Does Not Affect Its Value</title>
@@ -11309,10 +11309,10 @@ $ @kbd{gawk 'BEGIN @{ printf "0x11 is <%s>\n", 0x11
@}'}
@subsubsection Regular Expression Constants
@cindex regexp constants
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
A @dfn{regexp constant} is a regular expression description enclosed in
slashes, such as @address@hidden/^beginning and end$/}}. Most regexps used in
@command{awk} programs are constant, but the @samp{~} and @samp{!~}
@@ -11337,7 +11337,7 @@ POSIX @command{awk} and @command{gawk}, and then goes
on to describe
@node Standard Regexp Constants
@subsubsection Standard Regular Expression Constants
address@hidden dark corner, regexp constants
address@hidden dark corner @subentry regexp constants
When used on the righthand side of the @samp{~} or @samp{!~}
operators, a regexp constant merely stands for the regexp that is to be
matched.
@@ -11375,8 +11375,8 @@ if (/foo/ ~ $1) print "found foo"
@c @cindex automatic warnings
@c @cindex warnings, automatic
address@hidden @command{gawk}, regexp constants and
address@hidden regexp constants, in @command{gawk}
address@hidden @command{gawk} @subentry regexp constants and
address@hidden regexp constants @subentry in @command{gawk}
@noindent
This code is ``obviously'' testing @code{$1} for a match against the regexp
@code{/foo/}. But in fact, the expression @samp{/foo/ ~ $1} really means
@@ -11397,8 +11397,8 @@ matches = /foo/
assigns either zero or one to the variable @code{matches}, depending
upon the contents of the current input record.
address@hidden differences in @command{awk} and @command{gawk}, regexp constants
address@hidden dark corner, regexp constants, as arguments to user-defined
functions
address@hidden differences in @command{awk} and @command{gawk} @subentry regexp
constants
address@hidden dark corner @subentry regexp constants @subentry as arguments to
user-defined functions
@cindexgawkfunc{gensub}
@cindexawkfunc{sub}
@cindexawkfunc{gsub}
@@ -11473,7 +11473,7 @@ it would be nice to have regexp constants that
are @dfn{strongly typed}; in other words, that denote a regexp useful
for matching, and not an expression.
address@hidden values, regexp
address@hidden values @subentry regexp
@command{gawk} provides this feature. A strongly typed regexp constant
looks almost like a regular regexp constant, except that it is preceded
by an @samp{@@} sign:
@@ -11536,8 +11536,8 @@ value of the original regexp text.
@node Variables
@subsection Variables
address@hidden variables, user-defined
address@hidden user-defined, variables
address@hidden variables @subentry user-defined
address@hidden user-defined @subentry variables
@dfn{Variables} are ways of storing values at one point in your program for
use later in another part of your program. They can be manipulated
entirely within the program text, and they can also be assigned values
@@ -11573,8 +11573,8 @@ change a variable's value, and the @code{match()},
@code{split()},
and @code{patsplit()} functions can change the contents of their
array parameters (@pxref{String Functions}).
address@hidden variables, built-in
address@hidden variables, initializing
address@hidden variables @subentry built-in
address@hidden variables @subentry initializing
A few variables have special built-in meanings, such as @code{FS} (the
field separator) and @code{NF} (the number of fields in the current input
record). @xref{Built-in Variables} for a list of the predefined variables.
@@ -11591,8 +11591,8 @@ which is what you would do in C and in most other
traditional languages.
@node Assignment Options
@subsubsection Assigning Variables on the Command Line
address@hidden variables, assigning on command line
address@hidden command line, address@hidden assigning on
address@hidden variables @subentry assigning on command line
address@hidden command line @subentry variables, assigning on
Any @command{awk} variable can be set by including a @dfn{variable assignment}
among the arguments on the command line when @command{awk} is invoked
@@ -11646,7 +11646,7 @@ $ @kbd{awk '@{ print $n @}' n=4 inventory-shipped n=2
mail-list}
@dots{}
@end example
address@hidden dark corner, command-line arguments
address@hidden dark corner @subentry command-line arguments
Command-line arguments are made available for explicit examination by
the @command{awk} program in the @code{ARGV} array
(@pxref{ARGC and ARGV}).
@@ -11687,10 +11687,10 @@ this @value{SECTION} discusses this important facet
of @command{awk}.
@node Strings And Numbers
@subsubsection How @command{awk} Converts Between Strings and Numbers
address@hidden converting, strings to numbers
address@hidden strings, converting
address@hidden numbers, converting
address@hidden converting, numbers to strings
address@hidden converting @subentry strings to numbers
address@hidden strings @subentry converting
address@hidden numbers @subentry converting
address@hidden converting @subentry numbers to strings
Strings are converted to numbers and numbers are converted to strings, if the
context
of the @command{awk} program demands it. For example, if the value of
either @code{foo} or @code{bar} in the expression @samp{foo + bar}
@@ -11711,7 +11711,7 @@ the variables @code{two} and @code{three} are converted
to strings and
concatenated together. The resulting string is converted back to the
number 23, to which 4 is then added.
address@hidden null strings, converting numbers to strings
address@hidden null strings @subentry converting numbers to strings
@cindex type conversion
If, for some reason, you need to force a number to be converted to a
string, concatenate that number with the empty string, @code{""}.
@@ -11738,7 +11738,7 @@ On most modern machines,
value address@hidden cases can require up to
752 digits (!), but we doubt that you need to worry about this.}
address@hidden dark corner, @code{CONVFMT} variable
address@hidden dark corner @subentry @code{CONVFMT} variable
Strange results can occur if you set @code{CONVFMT} to a string that doesn't
tell @code{sprintf()} how to format floating-point numbers in a useful way.
For example, if you forget the @samp{%} in the format, @command{awk} converts
@@ -11758,16 +11758,16 @@ b = a ""
@code{b} has the value @code{"12"}, not @code{"12.00"}.
@value{DARKCORNER}
address@hidden sidebar, Pre-POSIX @command{awk} Used @code{OFMT} for String
Conversion
address@hidden sidebar @subentry Pre-POSIX @command{awk} Used @code{OFMT} for
String Conversion
@ifdocbook
@docbook
<sidebar><title>Pre-POSIX @command{awk} Used @code{OFMT} for String
Conversion</title>
@end docbook
address@hidden POSIX @command{awk}, @code{OFMT} variable and
address@hidden POSIX @command{awk} @subentry @code{OFMT} variable and
@cindex @code{OFMT} variable
address@hidden portability, new @command{awk} vs.@: old @command{awk}
address@hidden @command{awk}, new vs.@: old, @code{OFMT} variable
address@hidden portability @subentry new @command{awk} vs.@: old @command{awk}
address@hidden @command{awk} @subentry new vs.@: old @subentry @code{OFMT}
variable
Prior to the POSIX standard, @command{awk} used the value
of @code{OFMT} for converting numbers to strings. @code{OFMT}
specifies the output format to use when printing numbers with @code{print}.
@@ -11787,10 +11787,10 @@ of cases, old @command{awk} programs do not change
their behavior.
@center @b{Pre-POSIX @command{awk} Used @code{OFMT} for String Conversion}
address@hidden POSIX @command{awk}, @code{OFMT} variable and
address@hidden POSIX @command{awk} @subentry @code{OFMT} variable and
@cindex @code{OFMT} variable
address@hidden portability, new @command{awk} vs.@: old @command{awk}
address@hidden @command{awk}, new vs.@: old, @code{OFMT} variable
address@hidden portability @subentry new @command{awk} vs.@: old @command{awk}
address@hidden @command{awk} @subentry new vs.@: old @subentry @code{OFMT}
variable
Prior to the POSIX standard, @command{awk} used the value
of @code{OFMT} for converting numbers to strings. @code{OFMT}
specifies the output format to use when printing numbers with @code{print}.
@@ -11816,7 +11816,7 @@ non-English locales use the comma (@samp{,}) as the
decimal point
character. European locales often use either a space or a period as
the thousands separator, if they have one.
address@hidden dark corner, locale's decimal point character
address@hidden dark corner @subentry locale's decimal point character
The POSIX standard says that @command{awk} always uses the period as the
decimal
point when reading the @command{awk} program source code, and for
command-line variable assignments (@pxref{Other Arguments}). However,
@@ -11891,7 +11891,7 @@ of the values provided by constants and variables.
@node Arithmetic Ops
@subsection Arithmetic Operators
@cindex arithmetic operators
address@hidden operators, arithmetic
address@hidden operators @subentry arithmetic
@c @cindex addition
@c @cindex subtraction
@c @cindex multiplication
@@ -11930,9 +11930,9 @@ The following list provides the arithmetic operators in
@command{awk},
in order from the highest precedence to the lowest:
@table @code
address@hidden common extensions, @code{**} operator
address@hidden extensions, address@hidden @code{**} operator
address@hidden POSIX @command{awk}, arithmetic operators and
address@hidden common extensions @subentry @code{**} operator
address@hidden extensions @subentry common, @code{**} operator
address@hidden POSIX @command{awk} @subentry arithmetic operators and
@item @var{x} ^ @var{y}
@itemx @var{x} ** @var{y}
Exponentiation; @var{x} raised to the @var{y} power. @samp{2 ^ 3} has
@@ -11948,7 +11948,7 @@ Unary plus; the expression is converted to a number.
@item @var{x} * @var{y}
Multiplication.
address@hidden troubleshooting, division
address@hidden troubleshooting @subentry division
@cindex division
@item @var{x} / @var{y}
Division; because all numbers in @command{awk} are floating-point
@@ -11973,7 +11973,7 @@ Unary plus and minus have the same precedence,
the multiplication operators all have the same precedence, and
addition and subtraction have the same precedence.
address@hidden differences in @command{awk} and @command{gawk}, trunc-mod
operation
address@hidden differences in @command{awk} and @command{gawk} @subentry
trunc-mod operation
@cindex trunc-mod operation
When computing the remainder of @address@hidden % @var{y}},
the quotient is rounded toward zero to an integer and
@@ -11996,9 +11996,9 @@ In other @command{awk} implementations, the signedness
of the remainder
may be machine-dependent.
@c FIXME !!! what does posix say?
address@hidden portability, @code{**} operator and
address@hidden @code{*} (asterisk), @code{**} operator
address@hidden asterisk (@code{*}), @code{**} operator
address@hidden portability @subentry @code{**} operator and
address@hidden @code{*} (asterisk) @subentry @code{**} operator
address@hidden asterisk (@code{*}) @subentry @code{**} operator
@quotation NOTE
The POSIX standard only specifies the use of @samp{^}
for exponentiation.
@@ -12014,7 +12014,7 @@ For maximum portability, do not use the @samp{**}
operator.
@end quotation
@cindex string operators
address@hidden operators, string
address@hidden operators @subentry string
@cindex concatenating
There is only one string operation: concatenation. It does not have a
specific operator to represent it. Instead, concatenation is performed by
@@ -12037,7 +12037,7 @@ $ @kbd{awk '@{ print "Field number one:" $1 @}'
mail-list}
@dots{}
@end example
address@hidden troubleshooting, string concatenation
address@hidden troubleshooting @subentry string concatenation
Because string concatenation does not have an explicit operator, it is
often necessary to ensure that it happens at the right time by using
parentheses to enclose the items to concatenate. For example,
@@ -12064,7 +12064,7 @@ print "something meaningful" > (file name)
@end example
@cindex order of evaluation, concatenation
address@hidden evaluation order, concatenation
address@hidden evaluation order @subentry concatenation
@cindex side effects
Parentheses should be used around concatenation in all but the
most common contexts, such as on the righthand side of @samp{=}.
@@ -12145,10 +12145,10 @@ you're never quite sure what you'll get.
@node Assignment Ops
@subsection Assignment Expressions
@cindex assignment operators
address@hidden operators, assignment
address@hidden expressions, assignment
address@hidden @code{=} (equals sign), @code{=} operator
address@hidden equals sign (@code{=}), @code{=} operator
address@hidden operators @subentry assignment
address@hidden expressions @subentry assignment
address@hidden @code{=} (equals sign) @subentry @code{=} operator
address@hidden equals sign (@code{=}) @subentry @code{=} operator
An @dfn{assignment} is an expression that stores a (usually different)
value into a variable. For example, let's assign the value one to the variable
@code{z}:
@@ -12171,7 +12171,7 @@ message = "this " thing " is " predicate
@end example
@noindent
address@hidden side effects, assignment expressions
address@hidden side effects @subentry assignment expressions
This also illustrates string concatenation.
The @samp{=} sign is called an @dfn{assignment operator}. It is the
simplest assignment operator because the value of the righthand
@@ -12185,8 +12185,8 @@ a @dfn{side effect}.
@cindex lvalues/rvalues
@cindex rvalues/lvalues
address@hidden assignment operators, lvalues/rvalues
address@hidden operators, assignment
address@hidden assignment operators @subentry lvalues/rvalues
address@hidden operators @subentry assignment
The lefthand operand of an assignment need not be a variable
(@pxref{Variables}); it can also be a field
(@pxref{Changing Fields}) or
@@ -12197,7 +12197,7 @@ The righthand operand may be any expression; it
produces the new value
that the assignment stores in the specified variable, field, or array
element. (Such values are called @dfn{rvalues}.)
address@hidden variables, types of
address@hidden variables @subentry types of
It is important to note that variables do @emph{not} have permanent types.
A variable's type is simply the type of whatever value was last assigned
to it. In the following program fragment, the variable
@@ -12255,8 +12255,8 @@ and then test whether @code{x} equals one. But this
style tends to make
programs hard to read; such nesting of assignments should be avoided,
except perhaps in a one-shot program.
address@hidden @code{+} (plus sign), @code{+=} operator
address@hidden plus sign (@code{+}), @code{+=} operator
address@hidden @code{+} (plus sign) @subentry @code{+=} operator
address@hidden plus sign (@code{+}) @subentry @code{+=} operator
Aside from @samp{=}, there are several other assignment operators that
do arithmetic with the old value of the variable. For example, the
operator @samp{+=} computes a new value by adding the righthand value
@@ -12299,8 +12299,8 @@ BEGIN @{
@end group
@end example
address@hidden operators, assignment, evaluation order
address@hidden assignment operators, evaluation order
address@hidden operators @subentry assignment @subentry evaluation order
address@hidden assignment operators @subentry evaluation order
@noindent
The indices of @code{bar} are practically guaranteed to be different, because
@code{rand()} returns different values each time it is called.
@@ -12333,18 +12333,18 @@ The value of @code{a[3]} could be either two or four.
case, the righthand operand is an expression whose value is converted
to a number.
address@hidden @code{-} (hyphen), @code{-=} operator
address@hidden hyphen (@code{-}), @code{-=} operator
address@hidden @code{*} (asterisk), @code{*=} operator
address@hidden asterisk (@code{*}), @code{*=} operator
address@hidden @code{/} (forward slash), @code{/=} operator
address@hidden forward slash (@code{/}), @code{/=} operator
address@hidden @code{%} (percent sign), @code{%=} operator
address@hidden percent sign (@code{%}), @code{%=} operator
address@hidden @code{^} (caret), @code{^=} operator
address@hidden caret (@code{^}), @code{^=} operator
address@hidden @code{*} (asterisk), @code{**=} operator
address@hidden asterisk (@code{*}), @code{**=} operator
address@hidden @code{-} (hyphen) @subentry @code{-=} operator
address@hidden hyphen (@code{-}) @subentry @code{-=} operator
address@hidden @code{*} (asterisk) @subentry @code{*=} operator
address@hidden asterisk (@code{*}) @subentry @code{*=} operator
address@hidden @code{/} (forward slash) @subentry @code{/=} operator
address@hidden forward slash (@code{/}) @subentry @code{/=} operator
address@hidden @code{%} (percent sign) @subentry @code{%=} operator
address@hidden percent sign (@code{%}) @subentry @code{%=} operator
address@hidden @code{^} (caret) @subentry @code{^=} operator
address@hidden caret (@code{^}) @subentry @code{^=} operator
address@hidden @code{*} (asterisk) @subentry @code{**=} operator
address@hidden asterisk (@code{*}) @subentry @code{**=} operator
@float Table,table-assign-ops
@caption{Arithmetic assignment operators}
@multitable @columnfractions .30 .70
@@ -12354,8 +12354,8 @@ to a number.
@item @var{lvalue} @code{*=} @var{coefficient} @tab Multiply the value of
@var{lvalue} by @var{coefficient}.
@item @var{lvalue} @code{/=} @var{divisor} @tab Divide the value of
@var{lvalue} by @var{divisor}.
@item @var{lvalue} @code{%=} @var{modulus} @tab Set @var{lvalue} to its
remainder by @var{modulus}.
address@hidden common extensions, @code{**=} operator
address@hidden extensions, address@hidden @code{**=} operator
address@hidden common extensions @subentry @code{**=} operator
address@hidden extensions @subentry common, @code{**=} operator
@cindex @command{awk} language, POSIX version
@cindex POSIX @command{awk}
@item @var{lvalue} @code{^=} @var{power} @tab Raise @var{lvalue} to the power
@var{power}.
@@ -12363,28 +12363,28 @@ to a number.
@end multitable
@end float
address@hidden POSIX @command{awk}, @code{**=} operator and
address@hidden portability, @code{**=} operator and
address@hidden POSIX @command{awk} @subentry @code{**=} operator and
address@hidden portability @subentry @code{**=} operator and
@quotation NOTE
Only the @samp{^=} operator is specified by POSIX.
For maximum portability, do not use the @samp{**=} operator.
@end quotation
address@hidden sidebar, Syntactic Ambiguities Between @samp{/=} and Regular
Expressions
address@hidden sidebar @subentry Syntactic Ambiguities Between @samp{/=} and
Regular Expressions
@ifdocbook
@docbook
<sidebar><title>Syntactic Ambiguities Between @samp{/=} and Regular
Expressions</title>
@end docbook
address@hidden dark corner, regexp constants, @code{/=} operator and
address@hidden @code{/} (forward slash), @code{/=} operator, vs.
@code{/address@hidden/} regexp constant
address@hidden forward slash (@code{/}), @code{/=} operator, vs.
@code{/address@hidden/} regexp constant
address@hidden regexp constants, @code{/address@hidden/}, @code{/=} operator and
address@hidden dark corner @subentry regexp constants @subentry @code{/=}
operator and
address@hidden @code{/} (forward slash) @subentry @code{/=} operator @subentry
vs. @code{/address@hidden/} regexp constant
address@hidden forward slash (@code{/}) @subentry @code{/=} operator @subentry
vs. @code{/address@hidden/} regexp constant
address@hidden regexp constants @subentry @code{/address@hidden/} @subentry
@code{/=} operator and
@c derived from email from "Nelson H. F. Beebe" <address@hidden>
@c Date: Mon, 1 Sep 1997 13:38:35 -0600 (MDT)
address@hidden dark corner, @code{/=} operator vs. @code{/address@hidden/}
regexp constant
address@hidden dark corner @subentry @code{/=} operator vs.
@code{/address@hidden/} regexp constant
@cindex ambiguity, syntactic: @code{/=} operator vs. @code{/address@hidden/}
regexp constant
@cindex syntactic ambiguity: @code{/=} operator vs. @code{/address@hidden/}
regexp constant
@cindex @code{/=} operator vs. @code{/address@hidden/} regexp constant
@@ -12422,15 +12422,15 @@ and @command{mawk} also do not.
@center @b{Syntactic Ambiguities Between @samp{/=} and Regular Expressions}
address@hidden dark corner, regexp constants, @code{/=} operator and
address@hidden @code{/} (forward slash), @code{/=} operator, vs.
@code{/address@hidden/} regexp constant
address@hidden forward slash (@code{/}), @code{/=} operator, vs.
@code{/address@hidden/} regexp constant
address@hidden regexp constants, @code{/address@hidden/}, @code{/=} operator and
address@hidden dark corner @subentry regexp constants @subentry @code{/=}
operator and
address@hidden @code{/} (forward slash) @subentry @code{/=} operator @subentry
vs. @code{/address@hidden/} regexp constant
address@hidden forward slash (@code{/}) @subentry @code{/=} operator @subentry
vs. @code{/address@hidden/} regexp constant
address@hidden regexp constants @subentry @code{/address@hidden/} @subentry
@code{/=} operator and
@c derived from email from "Nelson H. F. Beebe" <address@hidden>
@c Date: Mon, 1 Sep 1997 13:38:35 -0600 (MDT)
address@hidden dark corner, @code{/=} operator vs. @code{/address@hidden/}
regexp constant
address@hidden dark corner @subentry @code{/=} operator vs.
@code{/address@hidden/} regexp constant
@cindex ambiguity, syntactic: @code{/=} operator vs. @code{/address@hidden/}
regexp constant
@cindex syntactic ambiguity: @code{/=} operator vs. @code{/address@hidden/}
regexp constant
@cindex @code{/=} operator vs. @code{/address@hidden/} regexp constant
@@ -12464,16 +12464,16 @@ and @command{mawk} also do not.
@subsection Increment and Decrement Operators
@cindex increment operators
address@hidden operators, decrement/increment
address@hidden operators @subentry decrement/increment
@dfn{Increment} and @dfn{decrement operators} increase or decrease the value of
a variable by one. An assignment operator can do the same thing, so
the increment operators add no power to the @command{awk} language; however,
they
are convenient abbreviations for very common operations.
@cindex side effects
address@hidden @code{+} (plus sign), @code{++} operator
address@hidden plus sign (@code{+}), @code{++} operator
address@hidden side effects, decrement/increment operators
address@hidden @code{+} (plus sign) @subentry @code{++} operator
address@hidden plus sign (@code{+}) @subentry @code{++} operator
address@hidden side effects @subentry decrement/increment operators
The operator used for adding one is written @samp{++}. It can be used to
increment
a variable either before or after taking its value.
To @dfn{pre-increment} a variable @code{v}, write @samp{++v}. This adds
@@ -12504,8 +12504,8 @@ long as you stick to numbers that are fairly small
(less than
@end ifnotinfo
@end ifnottex
address@hidden @code{$} (dollar sign), incrementing fields and arrays
address@hidden dollar sign (@code{$}), incrementing fields and arrays
address@hidden @code{$} (dollar sign) @subentry incrementing fields and arrays
address@hidden dollar sign (@code{$}) @subentry incrementing fields and arrays
Fields and array elements are incremented
just like variables. (Use @samp{$(i++)} when you want to do a field reference
and a variable increment at the same time. The parentheses are necessary
@@ -12518,8 +12518,8 @@ the lvalue to pre-decrement or after it to
post-decrement.
Following is a summary of increment and decrement expressions:
@table @code
address@hidden @code{+} (plus sign), @code{++} operator
address@hidden plus sign (@code{+}), @code{++} operator
address@hidden @code{+} (plus sign) @subentry @code{++} operator
address@hidden plus sign (@code{+}) @subentry @code{++} operator
@item address@hidden
Increment @var{lvalue}, returning the new value as the
value of the expression.
@@ -12528,8 +12528,8 @@ value of the expression.
Increment @var{lvalue}, returning the @emph{old} value of @var{lvalue}
as the value of the expression.
address@hidden @code{-} (hyphen), @code{--} operator
address@hidden hyphen (@code{-}), @code{--} operator
address@hidden @code{-} (hyphen) @subentry @code{--} operator
address@hidden hyphen (@code{-}) @subentry @code{--} operator
@item address@hidden
Decrement @var{lvalue}, returning the new value as the
value of the expression.
@@ -12543,15 +12543,15 @@ as the value of the expression.
like @address@hidden, but instead of adding, it subtracts.)
@end table
address@hidden sidebar, Operator Evaluation Order
address@hidden sidebar @subentry Operator Evaluation Order
@ifdocbook
@docbook
<sidebar><title>Operator Evaluation Order</title>
@end docbook
@cindex precedence
address@hidden operators, precedence of
address@hidden portability, operators
address@hidden operators @subentry precedence of
address@hidden portability @subentry operators
@cindex evaluation order
@cindex Marx, Groucho
@quotation
@@ -12602,8 +12602,8 @@ You should avoid such things in your own programs.
@cindex precedence
address@hidden operators, precedence of
address@hidden portability, operators
address@hidden operators @subentry precedence of
address@hidden portability @subentry operators
@cindex evaluation order
@cindex Marx, Groucho
@quotation
@@ -12696,7 +12696,7 @@ BEGIN @{
@}
@end example
address@hidden dark corner, @code{"0"} is actually true
address@hidden dark corner @subentry @code{"0"} is actually true
There is a surprising consequence of the ``nonzero or non-null'' rule:
the string constant @code{"0"} is actually true, because it is non-null.
@value{DARKCORNER}
@@ -12712,13 +12712,13 @@ the string constant @code{"0"} is actually true,
because it is non-null.
@c leave it alone.
@cindex comparison expressions
address@hidden expressions, comparison
address@hidden expressions, matching, See comparison expressions
address@hidden matching, expressions, See comparison expressions
address@hidden relational operators, See comparison operators
address@hidden operators, relational, See address@hidden comparison
address@hidden expressions @subentry comparison
address@hidden expressions, matching @seeentry{comparison expressions}
address@hidden matching, expressions @seeentry{comparison expressions}
address@hidden relational operators @seeentry{comparison operators}
address@hidden operators, relational @address@hidden comparison}
@cindex variable typing
address@hidden variables, types of, comparison expressions and
address@hidden variables @subentry types of @subentry comparison expressions and
Unlike in other programming languages, in @command{awk} variables do not have a
fixed type. Instead, they can be either a number or a string, depending
upon the value that is assigned to them.
@@ -12812,9 +12812,9 @@ $ @kbd{echo 37 | awk '@{ printf("%s %s < 42\n", $1,}
Here are the rules for when @command{awk}
treats data as a number, and for when it treats data as a string.
address@hidden numeric, strings
address@hidden strings, numeric
address@hidden POSIX @command{awk}, numeric strings and
address@hidden numeric @subentry strings
address@hidden strings @subentry numeric
address@hidden POSIX @command{awk} @subentry numeric strings and
The POSIX standard uses the term @dfn{numeric string} for input data that
looks numeric. The @samp{37} in the previous example is a numeric string.
So what is the type of a numeric string? Answer: numeric.
@@ -13032,22 +13032,22 @@ relationships such as equality. They are written
using @dfn{relational
operators}, which are a superset of those in C.
@ref{table-relational-ops} describes them.
address@hidden @code{<} (left angle bracket), @code{<} operator
address@hidden left angle bracket (@code{<}), @code{<} operator
address@hidden @code{<} (left angle bracket), @code{<=} operator
address@hidden left angle bracket (@code{<}), @code{<=} operator
address@hidden @code{>} (right angle bracket), @code{>=} operator
address@hidden right angle bracket (@code{>}), @code{>=} operator
address@hidden @code{>} (right angle bracket), @code{>} operator
address@hidden right angle bracket (@code{>}), @code{>} operator
address@hidden @code{=} (equals sign), @code{==} operator
address@hidden equals sign (@code{=}), @code{==} operator
address@hidden @code{!} (exclamation point), @code{!=} operator
address@hidden exclamation point (@code{!}), @code{!=} operator
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @code{<} (left angle bracket) @subentry @code{<} operator
address@hidden left angle bracket (@code{<}) @subentry @code{<} operator
address@hidden @code{<} (left angle bracket) @subentry @code{<=} operator
address@hidden left angle bracket (@code{<}) @subentry @code{<=} operator
address@hidden @code{>} (right angle bracket) @subentry @code{>=} operator
address@hidden right angle bracket (@code{>}) @subentry @code{>=} operator
address@hidden @code{>} (right angle bracket) @subentry @code{>} operator
address@hidden right angle bracket (@code{>}) @subentry @code{>} operator
address@hidden @code{=} (equals sign) @subentry @code{==} operator
address@hidden equals sign (@code{=}) @subentry @code{==} operator
address@hidden @code{!} (exclamation point) @subentry @code{!=} operator
address@hidden exclamation point (@code{!}) @subentry @code{!=} operator
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
@cindex @code{in} operator
@float Table,table-relational-ops
@caption{Relational operators}
@@ -13076,7 +13076,7 @@ and so on. Thus, @code{"10"} is less than @code{"9"}.
If there are two
strings where one is a prefix of the other, the shorter string is less than
the longer one. Thus, @code{"abc"} is less than @code{"abcd"}.
address@hidden troubleshooting, @code{==} operator
address@hidden troubleshooting @subentry @code{==} operator
It is very easy to accidentally mistype the @samp{==} operator and
leave off one of the @samp{=} characters. The result is still valid
@command{awk} code, but the program does not do what is intended:
@@ -13128,7 +13128,7 @@ $ @kbd{echo 1e2 3 | awk '@{ print ($1 < $2) ? "true" :
"false" @}'}
@print{} false
@end example
address@hidden comparison expressions, string vs.@: regexp
address@hidden comparison expressions @subentry string vs.@: regexp
@c @cindex string comparison vs.@: regexp comparison
@c @cindex regexp comparison vs.@: string comparison
@noindent
@@ -13158,17 +13158,17 @@ x ~ /foo/
has the value one if @code{x} contains @samp{foo}, such as
@code{"Oh, what a fool am I!"}.
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
The righthand operand of the @samp{~} and @samp{!~} operators may be
either a regexp constant (@code{/address@hidden@code{/}) or an ordinary
expression. In the latter case, the value of the expression as a string is
used as a
dynamic regexp (@pxref{Regexp Usage}; also
@pxref{Computed Regexps}).
address@hidden @command{awk}, regexp constants and
address@hidden @command{awk} @subentry regexp constants and
@cindex regexp constants
A constant regular
expression in slashes by itself is also an expression.
@@ -13241,12 +13241,12 @@ and http://austingroupbugs.net/view.php?id=1070.
@cindex and Boolean-logic operator
@cindex or Boolean-logic operator
@cindex not Boolean-logic operator
address@hidden expressions, Boolean
address@hidden expressions @subentry Boolean
@cindex Boolean expressions
address@hidden operators, Boolean, See Boolean expressions
address@hidden Boolean operators, See Boolean expressions
address@hidden logical operators, See Boolean expressions
address@hidden operators, logical, See Boolean expressions
address@hidden operators, Boolean @seeentry{Boolean expressions}
address@hidden Boolean operators @seeentry{Boolean expressions}
address@hidden logical operators @seeentry{Boolean expressions}
address@hidden operators, logical @seeentry{Boolean expressions}
A @dfn{Boolean expression} is a combination of comparison expressions or
matching expressions, using the Boolean operators ``or''
@@ -13278,7 +13278,7 @@ both @samp{edu} and @samp{li}:
if ($0 ~ /edu/ && $0 ~ /li/) print
@end example
address@hidden side effects, Boolean operators
address@hidden side effects @subentry Boolean operators
The subexpression @var{boolean2} is evaluated only if @var{boolean1}
is true. This can make a difference when @var{boolean2} contains
expressions that have side effects. In the case of @samp{$0 ~ /foo/ &&
@@ -13318,11 +13318,11 @@ BEGIN @{ if (! ("HOME" in ENVIRON))
@end table
@cindex short-circuit operators
address@hidden operators, short-circuit
address@hidden @code{&} (ampersand), @code{&&} operator
address@hidden ampersand (@code{&}), @code{&&} operator
address@hidden @code{|} (vertical bar), @code{||} operator
address@hidden vertical bar (@code{|}), @code{||} operator
address@hidden operators @subentry short-circuit
address@hidden @code{&} (ampersand) @subentry @code{&&} operator
address@hidden ampersand (@code{&}) @subentry @code{&&} operator
address@hidden @code{|} (vertical bar) @subentry @code{||} operator
address@hidden vertical bar (@code{|}) @subentry @code{||} operator
The @samp{&&} and @samp{||} operators are called @dfn{short-circuit}
operators because of the way they work. Evaluation of the full expression
is ``short-circuited'' if the result can be determined partway through
@@ -13334,10 +13334,10 @@ by putting a newline after them. But you cannot put
a newline in front
of either of these operators without using backslash continuation
(@pxref{Statements/Lines}).
address@hidden @code{!} (exclamation point), @code{!} operator
address@hidden exclamation point (@code{!}), @code{!} operator
address@hidden @code{!} (exclamation point) @subentry @code{!} operator
address@hidden exclamation point (@code{!}) @subentry @code{!} operator
@cindex newlines
address@hidden variables, flag
address@hidden variables @subentry flag
@cindex flag variables
The actual value of an expression using the @samp{!} operator is
either one or zero, depending upon the truth value of the expression it
@@ -13391,8 +13391,8 @@ The reason it's there is to avoid printing the
bracketing
@node Conditional Exp
@subsection Conditional Expressions
@cindex conditional expressions
address@hidden expressions, conditional
address@hidden expressions, selecting
address@hidden expressions @subentry conditional
address@hidden expressions @subentry selecting
A @dfn{conditional expression} is a special kind of expression that has
three operands. It allows you to use one expression's value to select
@@ -13416,7 +13416,7 @@ For example, the following expression produces the
absolute value of @code{x}:
x >= 0 ? x : -x
@end example
address@hidden side effects, conditional expressions
address@hidden side effects @subentry conditional expressions
Each time the conditional expression is computed, only one of
@var{if-true-exp} and @var{if-false-exp} is used; the other is ignored.
This is important when the expressions have side effects. For example,
@@ -13434,9 +13434,9 @@ and the other is not.
@xref{Arrays},
for more information about arrays.
address@hidden differences in @command{awk} and @command{gawk}, line
continuations
address@hidden line continuations, @command{gawk}
address@hidden @command{gawk}, line continuation in
address@hidden differences in @command{awk} and @command{gawk} @subentry line
continuations
address@hidden line continuations @subentry @command{gawk}
address@hidden @command{gawk} @subentry line continuation in
As a minor @command{gawk} extension,
a statement that uses @samp{?:} can be continued simply
by putting a newline after either character.
@@ -13455,7 +13455,7 @@ This enables you to
ask for it by name at any point in the program. For
example, the function @code{sqrt()} computes the square root of a number.
address@hidden functions, built-in
address@hidden functions @subentry built-in
A fixed set of functions are @dfn{built in}, which means they are
available in every @command{awk} program. The @code{sqrt()} function is one
of these. @xref{Built-in} for a list of built-in
@@ -13466,7 +13466,7 @@ for instructions on how to do this.
Finally, @command{gawk} lets you write functions in C or C++
that may be called from your program (@pxref{Dynamic Extensions}).
address@hidden arguments, in function calls
address@hidden arguments @subentry in function calls
The way to use a function is with a @dfn{function call} expression,
which consists of the function name followed immediately by a list of
@dfn{arguments} in parentheses. The arguments are expressions that
@@ -13481,7 +13481,7 @@ atan2(y, x) @ii{two arguments}
rand() @ii{no arguments}
@end example
address@hidden troubleshooting, function call syntax
address@hidden troubleshooting @subentry function call syntax
@quotation CAUTION
Do not put any space between the function name and the opening parenthesis!
A user-defined function name looks just like the name of a
@@ -13516,7 +13516,7 @@ which is a way to choose the function to call at
runtime, instead of
when you write the source code to your program. We defer discussion of
this feature until later; see @ref{Indirect Calls}.
address@hidden side effects, function calls
address@hidden side effects @subentry function calls
Like every other expression, the function call has a value, often
called the @dfn{return value}, which is computed by the function
based on the arguments you give it. In this example, the return value
@@ -13566,7 +13566,7 @@ $ @kbd{awk -f matchit.awk}
@node Precedence
@section Operator Precedence (How Operators Nest)
@cindex precedence
address@hidden operators, precedence
address@hidden operators @subentry precedence
@dfn{Operator precedence} determines how operators are grouped when
different operators appear close by in one expression. For example,
@@ -13613,47 +13613,47 @@ to lowest precedence:
@item @code{(address@hidden@code{)}
Grouping.
address@hidden @code{$} (dollar sign), @code{$} field operator
address@hidden dollar sign (@code{$}), @code{$} field operator
address@hidden @code{$} (dollar sign) @subentry @code{$} field operator
address@hidden dollar sign (@code{$}) @subentry @code{$} field operator
@item @code{$}
Field reference.
address@hidden @code{+} (plus sign), @code{++} operator
address@hidden plus sign (@code{+}), @code{++} operator
address@hidden @code{-} (hyphen), @code{--} operator
address@hidden hyphen (@code{-}), @code{--} operator
address@hidden @code{+} (plus sign) @subentry @code{++} operator
address@hidden plus sign (@code{+}) @subentry @code{++} operator
address@hidden @code{-} (hyphen) @subentry @code{--} operator
address@hidden hyphen (@code{-}) @subentry @code{--} operator
@item @code{++ --}
Increment, decrement.
address@hidden @code{^} (caret), @code{^} operator
address@hidden caret (@code{^}), @code{^} operator
address@hidden @code{*} (asterisk), @code{**} operator
address@hidden asterisk (@code{*}), @code{**} operator
address@hidden @code{^} (caret) @subentry @code{^} operator
address@hidden caret (@code{^}) @subentry @code{^} operator
address@hidden @code{*} (asterisk) @subentry @code{**} operator
address@hidden asterisk (@code{*}) @subentry @code{**} operator
@item @code{^ **}
Exponentiation. These operators group right to left.
address@hidden @code{+} (plus sign), @code{+} operator
address@hidden plus sign (@code{+}), @code{+} operator
address@hidden @code{-} (hyphen), @code{-} operator
address@hidden hyphen (@code{-}), @code{-} operator
address@hidden @code{!} (exclamation point), @code{!} operator
address@hidden exclamation point (@code{!}), @code{!} operator
address@hidden @code{+} (plus sign) @subentry @code{+} operator
address@hidden plus sign (@code{+}) @subentry @code{+} operator
address@hidden @code{-} (hyphen) @subentry @code{-} operator
address@hidden hyphen (@code{-}) @subentry @code{-} operator
address@hidden @code{!} (exclamation point) @subentry @code{!} operator
address@hidden exclamation point (@code{!}) @subentry @code{!} operator
@item @code{+ - !}
Unary plus, minus, logical ``not.''
address@hidden @code{*} (asterisk), @code{*} operator, as multiplication
operator
address@hidden asterisk (@code{*}), @code{*} operator, as multiplication
operator
address@hidden @code{/} (forward slash), @code{/} operator
address@hidden forward slash (@code{/}), @code{/} operator
address@hidden @code{%} (percent sign), @code{%} operator
address@hidden percent sign (@code{%}), @code{%} operator
address@hidden @code{*} (asterisk) @subentry @code{*} operator @subentry as
multiplication operator
address@hidden asterisk (@code{*}) @subentry @code{*} operator @subentry as
multiplication operator
address@hidden @code{/} (forward slash) @subentry @code{/} operator
address@hidden forward slash (@code{/}) @subentry @code{/} operator
address@hidden @code{%} (percent sign) @subentry @code{%} operator
address@hidden percent sign (@code{%}) @subentry @code{%} operator
@item @code{* / %}
Multiplication, division, remainder.
address@hidden @code{+} (plus sign), @code{+} operator
address@hidden plus sign (@code{+}), @code{+} operator
address@hidden @code{-} (hyphen), @code{-} operator
address@hidden hyphen (@code{-}), @code{-} operator
address@hidden @code{+} (plus sign) @subentry @code{+} operator
address@hidden plus sign (@code{+}) @subentry @code{+} operator
address@hidden @code{-} (hyphen) @subentry @code{-} operator
address@hidden hyphen (@code{-}) @subentry @code{-} operator
@item @code{+ -}
Addition, subtraction.
@@ -13662,35 +13662,35 @@ There is no special symbol for concatenation.
The operands are simply written side by side
(@pxref{Concatenation}).
address@hidden @code{<} (left angle bracket), @code{<} operator
address@hidden left angle bracket (@code{<}), @code{<} operator
address@hidden @code{<} (left angle bracket), @code{<=} operator
address@hidden left angle bracket (@code{<}), @code{<=} operator
address@hidden @code{>} (right angle bracket), @code{>=} operator
address@hidden right angle bracket (@code{>}), @code{>=} operator
address@hidden @code{>} (right angle bracket), @code{>} operator
address@hidden right angle bracket (@code{>}), @code{>} operator
address@hidden @code{=} (equals sign), @code{==} operator
address@hidden equals sign (@code{=}), @code{==} operator
address@hidden @code{!} (exclamation point), @code{!=} operator
address@hidden exclamation point (@code{!}), @code{!=} operator
address@hidden @code{>} (right angle bracket), @code{>>} operator (I/O)
address@hidden right angle bracket (@code{>}), @code{>>} operator (I/O)
address@hidden operators, input/output
address@hidden @code{|} (vertical bar), @code{|} operator (I/O)
address@hidden vertical bar (@code{|}), @code{|} operator (I/O)
address@hidden operators, input/output
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}), @code{|&} operator (I/O)
address@hidden operators, input/output
address@hidden @code{<} (left angle bracket) @subentry @code{<} operator
address@hidden left angle bracket (@code{<}) @subentry @code{<} operator
address@hidden @code{<} (left angle bracket) @subentry @code{<=} operator
address@hidden left angle bracket (@code{<}) @subentry @code{<=} operator
address@hidden @code{>} (right angle bracket) @subentry @code{>=} operator
address@hidden right angle bracket (@code{>}) @subentry @code{>=} operator
address@hidden @code{>} (right angle bracket) @subentry @code{>} operator
address@hidden right angle bracket (@code{>}) @subentry @code{>} operator
address@hidden @code{=} (equals sign) @subentry @code{==} operator
address@hidden equals sign (@code{=}) @subentry @code{==} operator
address@hidden @code{!} (exclamation point) @subentry @code{!=} operator
address@hidden exclamation point (@code{!}) @subentry @code{!=} operator
address@hidden @code{>} (right angle bracket) @subentry @code{>>} operator (I/O)
address@hidden right angle bracket (@code{>}) @subentry @code{>>} operator (I/O)
address@hidden operators @subentry input/output
address@hidden @code{|} (vertical bar) @subentry @code{|} operator (I/O)
address@hidden vertical bar (@code{|}) @subentry @code{|} operator (I/O)
address@hidden operators @subentry input/output
address@hidden @code{|} (vertical bar) @subentry @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}) @subentry @code{|&} operator (I/O)
address@hidden operators @subentry input/output
@item @code{< <= == != > >= >> | |&}
Relational and redirection.
The relational operators and the redirections have the same precedence
level. Characters such as @samp{>} serve both as relationals and as
redirections; the context distinguishes between the two meanings.
address@hidden @code{print} statement, I/O operators in
address@hidden @code{printf} statement, I/O operators in
address@hidden @code{print} statement @subentry I/O operators in
address@hidden @code{printf} statement @subentry I/O operators in
Note that the I/O redirection operators in @code{print} and @code{printf}
statements belong to the statement level, not to expressions. The
redirection does not produce an expression that could be the operand of
@@ -13700,10 +13700,10 @@ parentheses. Such combinations (e.g., @samp{print
foo > a ? b : c})
result in syntax errors.
The correct way to write this statement is @samp{print foo > (a ? b : c)}.
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
@item @code{~ !~}
Matching, nonmatching.
@@ -13711,43 +13711,43 @@ Matching, nonmatching.
@item @code{in}
Array membership.
address@hidden @code{&} (ampersand), @code{&&} operator
address@hidden ampersand (@code{&}), @code{&&} operator
address@hidden @code{&} (ampersand) @subentry @code{&&} operator
address@hidden ampersand (@code{&}) @subentry @code{&&} operator
@item @code{&&}
Logical ``and.''
address@hidden @code{|} (vertical bar), @code{||} operator
address@hidden vertical bar (@code{|}), @code{||} operator
address@hidden @code{|} (vertical bar) @subentry @code{||} operator
address@hidden vertical bar (@code{|}) @subentry @code{||} operator
@item @code{||}
Logical ``or.''
address@hidden @code{?} (question mark), @code{?:} operator
address@hidden question mark (@code{?}), @code{?:} operator
address@hidden @code{:} (colon), @code{?:} operator
address@hidden colon (@code{:}), @code{?:} operator
address@hidden @code{?} (question mark) @subentry @code{?:} operator
address@hidden question mark (@code{?}) @subentry @code{?:} operator
address@hidden @code{:} (colon) @subentry @code{?:} operator
address@hidden colon (@code{:}) @subentry @code{?:} operator
@item @code{?:}
Conditional. This operator groups right to left.
address@hidden @code{+} (plus sign), @code{+=} operator
address@hidden plus sign (@code{+}), @code{+=} operator
address@hidden @code{-} (hyphen), @code{-=} operator
address@hidden hyphen (@code{-}), @code{-=} operator
address@hidden @code{*} (asterisk), @code{*=} operator
address@hidden asterisk (@code{*}), @code{*=} operator
address@hidden @code{*} (asterisk), @code{**=} operator
address@hidden asterisk (@code{*}), @code{**=} operator
address@hidden @code{/} (forward slash), @code{/=} operator
address@hidden forward slash (@code{/}), @code{/=} operator
address@hidden @code{%} (percent sign), @code{%=} operator
address@hidden percent sign (@code{%}), @code{%=} operator
address@hidden @code{^} (caret), @code{^=} operator
address@hidden caret (@code{^}), @code{^=} operator
address@hidden @code{+} (plus sign) @subentry @code{+=} operator
address@hidden plus sign (@code{+}) @subentry @code{+=} operator
address@hidden @code{-} (hyphen) @subentry @code{-=} operator
address@hidden hyphen (@code{-}) @subentry @code{-=} operator
address@hidden @code{*} (asterisk) @subentry @code{*=} operator
address@hidden asterisk (@code{*}) @subentry @code{*=} operator
address@hidden @code{*} (asterisk) @subentry @code{**=} operator
address@hidden asterisk (@code{*}) @subentry @code{**=} operator
address@hidden @code{/} (forward slash) @subentry @code{/=} operator
address@hidden forward slash (@code{/}) @subentry @code{/=} operator
address@hidden @code{%} (percent sign) @subentry @code{%=} operator
address@hidden percent sign (@code{%}) @subentry @code{%=} operator
address@hidden @code{^} (caret) @subentry @code{^=} operator
address@hidden caret (@code{^}) @subentry @code{^=} operator
@item @code{= += -= *= /= %= ^= **=}
Assignment. These operators group right to left.
@end table
address@hidden POSIX @command{awk}, @code{**} operator and
address@hidden portability, operators, not in POSIX @command{awk}
address@hidden POSIX @command{awk} @subentry @code{**} operator and
address@hidden portability @subentry operators @subentry not in POSIX
@command{awk}
@quotation NOTE
The @samp{|&}, @samp{**}, and @samp{**=} operators are not specified by POSIX.
For maximum portability, do not use them.
@@ -13894,7 +13894,7 @@ building something useful.
* Empty:: The empty pattern, which matches every record.
@end menu
address@hidden patterns, types of
address@hidden patterns @subentry types of
Patterns in @command{awk} control the execution of rules---a rule is
executed when its pattern matches the current input record.
The following is a summary of the types of @command{awk} patterns:
@@ -13935,8 +13935,8 @@ The empty pattern matches every input record.
@node Regexp Patterns
@subsection Regular Expressions as Patterns
address@hidden patterns, regular expressions as
address@hidden regular expressions, as patterns
address@hidden patterns @subentry regular expressions as
address@hidden regular expressions @subentry as patterns
Regular expressions are one of the first kinds of patterns presented
in this book.
@@ -13952,8 +13952,8 @@ END @{ print buzzwords, "buzzwords seen" @}
@node Expression Patterns
@subsection Expressions as Patterns
address@hidden expressions, as patterns
address@hidden patterns, expressions as
address@hidden expressions @subentry as patterns
address@hidden patterns @subentry expressions as
Any @command{awk} expression is valid as an @command{awk} pattern.
The pattern matches if the expression's value is nonzero (if a
@@ -13964,8 +13964,8 @@ value depends directly on the new input record's text;
otherwise, it
depends on only what has happened so far in the execution of the
@command{awk} program.
address@hidden comparison expressions, as patterns
address@hidden patterns, comparison expressions as
address@hidden comparison expressions @subentry as patterns
address@hidden patterns @subentry comparison expressions as
Comparison expressions, using the comparison operators described in
@ref{Typing and Comparison},
are a very common kind of pattern.
@@ -13978,12 +13978,12 @@ is used as a dynamic regular expression
The following example prints the second field of each input record
whose first field is precisely @samp{li}:
address@hidden @code{/} (forward slash), patterns and
address@hidden forward slash (@code{/}), patterns and
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @code{/} (forward slash) @subentry patterns and
address@hidden forward slash (@code{/}) @subentry patterns and
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
@example
$ @kbd{awk '$1 == "li" @{ print $2 @}' mail-list}
@end example
@@ -13999,15 +13999,15 @@ $ @kbd{awk '$1 ~ /li/ @{ print $2 @}' mail-list}
@print{} 555-6699
@end example
address@hidden regexp constants, as patterns
address@hidden patterns, regexp constants as
address@hidden regexp constants @subentry as patterns
address@hidden patterns @subentry regexp constants as
A regexp constant as a pattern is also a special case of an expression
pattern. The expression @code{/li/} has the value one if @samp{li}
appears in the current input record. Thus, as a pattern, @code{/li/}
matches any record containing @samp{li}.
@cindex Boolean expressions, as patterns
address@hidden patterns, Boolean expressions as
address@hidden patterns @subentry Boolean expressions as
Boolean expressions are also commonly used as patterns.
Whether the pattern
matches an input record depends on whether its subexpressions match.
@@ -14049,10 +14049,10 @@ $ @kbd{awk '! /li/' mail-list}
@end group
@end example
address@hidden @code{BEGIN} pattern, Boolean patterns and
address@hidden @code{END} pattern, Boolean patterns and
address@hidden @code{BEGINFILE} pattern, Boolean patterns and
address@hidden @code{ENDFILE} pattern, Boolean patterns and
address@hidden @code{BEGIN} pattern @subentry Boolean patterns and
address@hidden @code{END} pattern @subentry Boolean patterns and
address@hidden @code{BEGINFILE} pattern @subentry Boolean patterns and
address@hidden @code{ENDFILE} pattern @subentry Boolean patterns and
The subexpressions of a Boolean operator in a pattern can be constant regular
expressions, comparisons, or any other @command{awk} expressions. Range
patterns are not expressions, so they cannot appear inside Boolean
@@ -14068,8 +14068,8 @@ patterns is described in @ref{Precedence}.
@subsection Specifying Record Ranges with Patterns
@cindex range patterns
address@hidden patterns, ranges in
address@hidden lines, matching ranges of
address@hidden patterns @subentry ranges in
address@hidden lines @subentry matching ranges of
@cindex @code{,} (comma), in range patterns
@cindex comma (@code{,}), in range patterns
A @dfn{range pattern} is made of two patterns separated by a comma, in
@@ -14094,7 +14094,7 @@ input record; when this succeeds, the range pattern is
@dfn{turned off} again
for the following record. Then the range pattern goes back to checking
@var{begpat} against each record.
address@hidden @code{if} statement, address@hidden changing
address@hidden @code{if} statement @subentry actions, changing
The record that turns on the range pattern and the one that turns it
off both match the range pattern. If you don't want to operate on
these records, you can write @code{if} statements in the rule's action
@@ -14119,13 +14119,13 @@ looks like this:
@end example
@noindent
address@hidden lines, skipping between markers
address@hidden lines @subentry skipping between markers
@c @cindex flag variables
This program fails because the range pattern is both turned on and turned off
by the first line, which just has a @samp{%} on it. To accomplish this task,
write the program in the following manner, using a flag:
address@hidden @code{!} (exclamation point), @code{!} operator
address@hidden @code{!} (exclamation point) @subentry @code{!} operator
@example
/^%$/ @{ skip = ! skip; next @}
skip == 1 @{ next @} # skip lines with `skip' set
@@ -14151,7 +14151,7 @@ $ @kbd{echo Yes | gawk '(/1/,/2/) || /Yes/'}
@end example
@cindex range patterns, line continuation and
address@hidden dark corner, range patterns, line continuation and
address@hidden dark corner @subentry range patterns @subentry line continuation
and
As a minor point of interest, although it is poor style,
POSIX allows you to put a newline after the comma in
a range pattern. @value{DARKCORNER}
@@ -14193,8 +14193,8 @@ $ @kbd{awk '}
@print{} "li" appears in 4 records.
@end example
address@hidden @code{BEGIN} pattern, operators and
address@hidden @code{END} pattern, operators and
address@hidden @code{BEGIN} pattern @subentry operators and
address@hidden @code{END} pattern @subentry operators and
This program finds the number of records in the input file @file{mail-list}
that contain the string @samp{li}. The @code{BEGIN} rule prints a title
for the report. There is no need to use the @code{BEGIN} rule to
@@ -14242,7 +14242,7 @@ rule checks the @code{FNR} and @code{NR} variables.
@node I/O And BEGIN/END
@subsubsection Input/Output from @code{BEGIN} and @code{END} Rules
address@hidden input/output, from @code{BEGIN} and @code{END}
address@hidden input/output @subentry from @code{BEGIN} and @code{END}
There are several (sometimes subtle) points to be aware of when doing I/O
from a @code{BEGIN} or @code{END} rule.
The first has to do with the value of @code{$0} in a @code{BEGIN}
@@ -14255,11 +14255,11 @@ without a variable (@pxref{Getline}).
Another way is simply to assign a value to @code{$0}.
@cindex Brian Kernighan's @command{awk}
address@hidden differences in @command{awk} and @command{gawk},
@code{BEGIN}/@code{END} patterns
address@hidden POSIX @command{awk}, @code{BEGIN}/@code{END} patterns
address@hidden @code{print} statement, @code{BEGIN}/@code{END} patterns and
address@hidden @code{BEGIN} pattern, @code{print} statement and
address@hidden @code{END} pattern, @code{print} statement and
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{BEGIN}/@code{END} patterns
address@hidden POSIX @command{awk} @subentry @code{BEGIN}/@code{END} patterns
address@hidden @code{print} statement @subentry @code{BEGIN}/@code{END}
patterns and
address@hidden @code{BEGIN} pattern @subentry @code{print} statement and
address@hidden @code{END} pattern @subentry @code{print} statement and
The second point is similar to the first, but from the other direction.
Traditionally, due largely to implementation issues, @code{$0} and
@code{NF} were @emph{undefined} inside an @code{END} rule.
@@ -14282,10 +14282,10 @@ this in @code{BEGIN} rules, it is a very bad idea in
@code{END} rules,
at least in @command{gawk}. It is also poor style, because if an empty
line is needed in the output, the program should print one explicitly.
address@hidden @code{next} statement, @code{BEGIN}/@code{END} patterns and
address@hidden @code{nextfile} statement, @code{BEGIN}/@code{END} patterns and
address@hidden @code{BEGIN} pattern, @code{next}/@code{nextfile} statements and
address@hidden @code{END} pattern, @code{next}/@code{nextfile} statements and
address@hidden @code{next} statement @subentry @code{BEGIN}/@code{END} patterns
and
address@hidden @code{nextfile} statement @subentry @code{BEGIN}/@code{END}
patterns and
address@hidden @code{BEGIN} pattern @subentry @code{next}/@code{nextfile}
statements and
address@hidden @code{END} pattern @subentry @code{next}/@code{nextfile}
statements and
Finally, the @code{next} and @code{nextfile} statements are not allowed
in a @code{BEGIN} rule, because the implicit
read-a-record-and-match-against-the-rules loop has not started yet.
Similarly, those statements
@@ -14302,7 +14302,7 @@ are not valid in an @code{END} rule, because all the
input has been read.
@subsection The @code{BEGINFILE} and @code{ENDFILE} Special Patterns
@cindex @code{BEGINFILE} pattern
@cindex @code{ENDFILE} pattern
address@hidden differences in @command{awk} and @command{gawk},
@code{BEGINFILE}/@code{ENDFILE} patterns
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{BEGINFILE}/@code{ENDFILE} patterns
This @value{SECTION} describes a @command{gawk}-specific feature.
@@ -14337,9 +14337,9 @@ file named on the command line cannot be opened for
reading. However,
you can bypass the fatal error and move on to the next file on the
command line.
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @code{ERRNO} variable, with @code{BEGINFILE} pattern
address@hidden @code{nextfile} statement, @code{BEGINFILE}/@code{ENDFILE}
patterns and
address@hidden @command{gawk} @subentry @code{ERRNO} variable in
address@hidden @code{ERRNO} variable @subentry with @code{BEGINFILE} pattern
address@hidden @code{nextfile} statement @subentry
@code{BEGINFILE}/@code{ENDFILE} patterns and
You do this by checking if the @code{ERRNO} variable is not the empty
string; if so, then @command{gawk} was not able to open the file. In
this case, your program can execute the @code{nextfile} statement
@@ -14366,13 +14366,13 @@ rule is present, the error becomes non-fatal, and
instead @code{ERRNO}
is set. This makes it possible to catch and process I/O errors at the
level of the @command{awk} program.
address@hidden @code{next} statement, @code{BEGINFILE}/@code{ENDFILE} patterns
and
address@hidden @code{next} statement @subentry @code{BEGINFILE}/@code{ENDFILE}
patterns and
The @code{next} statement (@pxref{Next Statement}) is not allowed inside
either a @code{BEGINFILE} or an @code{ENDFILE} rule. The @code{nextfile}
statement is allowed only inside a
@code{BEGINFILE} rule, not inside an @code{ENDFILE} rule.
address@hidden @code{getline} statement, @code{BEGINFILE}/@code{ENDFILE}
patterns and
address@hidden @code{getline} statement @subentry
@code{BEGINFILE}/@code{ENDFILE} patterns and
The @code{getline} statement (@pxref{Getline}) is restricted inside
both @code{BEGINFILE} and @code{ENDFILE}: only redirected
forms of @code{getline} are allowed.
@@ -14407,7 +14407,7 @@ rule to grab it before moving on to the next file.]
@subsection The Empty Pattern
@cindex empty pattern
address@hidden patterns, empty
address@hidden patterns @subentry empty
An empty (i.e., nonexistent) pattern is considered to match @emph{every}
input record. For example, the program:
@@ -14420,8 +14420,8 @@ prints the first field of every record.
@node Using Shell Variables
@section Using Shell Variables in Programs
address@hidden shells, variables
address@hidden @command{awk} programs, shell variables in
address@hidden shells @subentry variables
address@hidden @command{awk} programs @subentry shell variables in
@c @cindex shell and @command{awk} interaction
@command{awk} programs are often used as components in larger
@@ -14431,7 +14431,7 @@ hold a pattern that the @command{awk} program searches
for.
There are two ways to get the value of the shell variable
into the body of the @command{awk} program.
address@hidden shells, quoting
address@hidden shells @subentry quoting
A common method is to use shell quoting to substitute
the variable's value into the program inside the script.
For example, consider the following program:
@@ -14507,12 +14507,12 @@ in outline, an @command{awk} program generally looks
like this:
@dots{}
@end display
address@hidden @address@hidden@}} (braces), actions and
address@hidden braces (@address@hidden@}}), actions and
address@hidden separators, for statements in actions
address@hidden newlines, separating statements in actions
address@hidden @code{;} (semicolon), separating statements in actions
address@hidden semicolon (@code{;}), separating statements in actions
address@hidden @address@hidden@}} (braces) @subentry actions and
address@hidden braces (@address@hidden@}}) @subentry actions and
address@hidden separators @subentry for statements in actions
address@hidden newlines @subentry separating statements in actions
address@hidden @code{;} (semicolon) @subentry separating statements in actions
address@hidden semicolon (@code{;}) @subentry separating statements in actions
An action consists of one or more @command{awk} @dfn{statements}, enclosed
in braces (@address@hidden@address@hidden@}}). Each statement specifies one
thing to do. The statements are separated by newlines or semicolons.
@@ -14529,7 +14529,7 @@ well. An omitted action is equivalent to
@address@hidden print $0 @}}:
The following types of statements are supported in @command{awk}:
@table @asis
address@hidden side effects, statements
address@hidden side effects @subentry statements
@item Expressions
Call functions or assign values to variables
(@pxref{Expressions}). Executing
@@ -14568,21 +14568,21 @@ For deleting array elements.
@node Statements
@section Control Statements in Actions
@cindex control statements
address@hidden statements, control, in actions
address@hidden actions, control statements in
address@hidden statements @subentry control, in actions
address@hidden actions @subentry control statements in
@dfn{Control statements}, such as @code{if}, @code{while}, and so on,
control the flow of execution in @command{awk} programs. Most of
@command{awk}'s
control statements are patterned after similar statements in C.
@cindex compound address@hidden control statements and
address@hidden statements, address@hidden control statements and
address@hidden body, in actions
address@hidden @address@hidden@}} (braces), statements, grouping
address@hidden braces (@address@hidden@}}), statements, grouping
address@hidden newlines, separating statements in actions
address@hidden @code{;} (semicolon), separating statements in actions
address@hidden semicolon (@code{;}), separating statements in actions
address@hidden statements @subentry compound, control statements and
address@hidden body @subentry in actions
address@hidden @address@hidden@}} (braces) @subentry statements, grouping
address@hidden braces (@address@hidden@}}) @subentry statements, grouping
address@hidden newlines @subentry separating statements in actions
address@hidden @code{;} (semicolon) @subentry separating statements in actions
address@hidden semicolon (@code{;}) @subentry separating statements in actions
All the control statements start with special keywords, such as @code{if}
and @code{while}, to distinguish them from simple expressions.
Many control statements contain other statements. For example, the
@@ -14664,8 +14664,8 @@ the first thing on its line.
@subsection The @code{while} Statement
@cindex @code{while} statement
@cindex loops
address@hidden loops, @code{while}
address@hidden loops, See Also @code{while} statement
address@hidden loops @subentry @code{while}
address@hidden loops @address@hidden statement}
In programming, a @dfn{loop} is a part of a program that can
be executed two or more times in succession.
@@ -14678,7 +14678,7 @@ while (@var{condition})
@var{body}
@end example
address@hidden body, in loops
address@hidden body @subentry in loops
@noindent
@var{body} is a statement called the @dfn{body} of the loop,
and @var{condition} is an expression that controls how long the loop
@@ -14726,7 +14726,7 @@ program is harder to read without it.
@node Do Statement
@subsection The @address@hidden Statement
@cindex @address@hidden statement
address@hidden loops, @address@hidden
address@hidden loops @subentry @address@hidden
The @code{do} loop is a variation of the @code{while} looping statement.
The @code{do} loop executes the @var{body} once and then repeats the
@@ -14772,7 +14772,7 @@ occasionally is there a real use for a @code{do}
statement.
@node For Statement
@subsection The @code{for} Statement
@cindex @code{for} statement
address@hidden loops, @code{for}, iterative
address@hidden loops @subentry @code{for} @subentry iterative
The @code{for} statement makes it more convenient to count iterations of a
loop. The general form of the @code{for} statement looks like this:
@@ -14847,7 +14847,7 @@ while (@var{condition}) @{
@}
@end example
address@hidden loops, @code{continue} statements and
address@hidden loops @subentry @code{continue} statements and
@noindent
The only exception is when the @code{continue} statement
(@pxref{Continue Statement}) is used
@@ -14949,8 +14949,8 @@ described in @ref{Getopt Function}.)
@node Break Statement
@subsection The @code{break} Statement
@cindex @code{break} statement
address@hidden loops, exiting
address@hidden loops, @code{break} statement and
address@hidden loops @subentry exiting
address@hidden loops @subentry @code{break} statement and
The @code{break} statement jumps out of the innermost @code{for},
@code{while}, or @code{do} loop that encloses it. The following example
@@ -15011,9 +15011,9 @@ This is discussed in @ref{Switch Statement}.
@c @cindex @code{break}, outside of loops
@c @cindex historical features
@c @cindex @command{awk} language, POSIX version
address@hidden POSIX @command{awk}, @code{break} statement and
address@hidden dark corner, @code{break} statement
address@hidden @command{gawk}, @code{break} statement in
address@hidden POSIX @command{awk} @subentry @code{break} statement and
address@hidden dark corner @subentry @code{break} statement
address@hidden @command{gawk} @subentry @code{break} statement in
@cindex Brian Kernighan's @command{awk}
The @code{break} statement has no meaning when
used outside the body of a loop or @code{switch}.
@@ -15077,9 +15077,9 @@ the increment (@samp{x++}) is never reached.
@c @cindex @code{continue}, outside of loops
@c @cindex historical features
@c @cindex @command{awk} language, POSIX version
address@hidden POSIX @command{awk}, @code{continue} statement and
address@hidden dark corner, @code{continue} statement
address@hidden @command{gawk}, @code{continue} statement in
address@hidden POSIX @command{awk} @subentry @code{continue} statement and
address@hidden dark corner @subentry @code{continue} statement
address@hidden @command{gawk} @subentry @code{continue} statement in
@cindex Brian Kernighan's @command{awk}
The @code{continue} statement has no special meaning with respect to the
@code{switch} statement, nor does it have any meaning when used outside the
@@ -15112,7 +15112,7 @@ Contrast this with the effect of the @code{getline}
function
flow of control in any way (i.e., the rest of the current action executes
with a new input record).
address@hidden @command{awk} programs, execution of
address@hidden @command{awk} programs @subentry execution of
At the highest level, @command{awk} program execution is a loop that reads
an input record and then tests each rule's pattern against it. If you
think of this loop as a @code{for} statement whose body contains the
@@ -15149,11 +15149,11 @@ The @code{next} statement is not allowed inside
@code{BEGINFILE} and
@c @cindex @command{awk} language, POSIX version
@c @cindex @code{next}, inside a user-defined function
address@hidden @code{BEGIN} pattern, @code{next}/@code{nextfile} statements and
address@hidden @code{END} pattern, @code{next}/@code{nextfile} statements and
address@hidden POSIX @command{awk}, @code{next}/@code{nextfile} statements and
address@hidden @code{next} statement, user-defined functions and
address@hidden functions, user-defined, @code{next}/@code{nextfile} statements
and
address@hidden @code{BEGIN} pattern @subentry @code{next}/@code{nextfile}
statements and
address@hidden @code{END} pattern @subentry @code{next}/@code{nextfile}
statements and
address@hidden POSIX @command{awk} @subentry @code{next}/@code{nextfile}
statements and
address@hidden @code{next} statement @subentry user-defined functions and
address@hidden functions @subentry user-defined @subentry
@code{next}/@code{nextfile} statements and
According to the POSIX standard, the behavior is undefined if the
@code{next} statement is used in a @code{BEGIN} or @code{END} rule.
@command{gawk} treats it as a syntax error. Although POSIX does not disallow
it,
@@ -15216,8 +15216,8 @@ inclusion into the POSIX standard.
See @uref{http://austingroupbugs.net/view.php?id=607, the Austin Group
website}.
@end quotation
address@hidden functions, user-defined, @code{next}/@code{nextfile} statements
and
address@hidden @code{nextfile} statement, user-defined functions and
address@hidden functions @subentry user-defined @subentry
@code{next}/@code{nextfile} statements and
address@hidden @code{nextfile} statement @subentry user-defined functions and
@cindex Brian Kernighan's @command{awk}
@cindex @command{mawk} utility
The current version of BWK @command{awk} and @command{mawk}
@@ -15239,8 +15239,8 @@ is ignored. The @code{exit} statement is written as
follows:
@code{exit} address@hidden code}]
@end display
address@hidden @code{BEGIN} pattern, @code{exit} statement and
address@hidden @code{END} pattern, @code{exit} statement and
address@hidden @code{BEGIN} pattern @subentry @code{exit} statement and
address@hidden @code{END} pattern @subentry @code{exit} statement and
When an @code{exit} statement is executed from a @code{BEGIN} rule, the
program stops processing everything immediately. No input records are
read. However, if an @code{END} rule is present,
@@ -15263,7 +15263,7 @@ the @code{END} rule.
@xref{Assert Function}
for an example that does this.
address@hidden dark corner, @code{exit} statement
address@hidden dark corner @subentry @code{exit} statement
If an argument is supplied to @code{exit}, its value is used as the exit
status code for the @command{awk} process. If no argument is supplied,
@code{exit} causes @command{awk} to return a ``success'' status.
@@ -15273,7 +15273,7 @@ called a second time from an @code{END} rule with no
argument,
@command{awk} uses the previously supplied exit value. @value{DARKCORNER}
@xref{Exit Status} for more information.
address@hidden programming conventions, @code{exit} statement
address@hidden programming conventions @subentry @code{exit} statement
For example, suppose an error condition occurs that is difficult or
impossible to handle. Conventionally, programs report this by
exiting with a nonzero status. An @command{awk} program can do this
@@ -15305,7 +15305,7 @@ results across different operating systems.
@node Built-in Variables
@section Predefined Variables
@cindex predefined variables
address@hidden variables, predefined
address@hidden variables @subentry predefined
Most @command{awk} variables are available to use for your own
purposes; they never change unless your program assigns values to
@@ -15316,7 +15316,7 @@ to tell @command{awk} how to do certain things. Others
are set
automatically by @command{awk}, so that they carry information from the
internal workings of @command{awk} to your program.
address@hidden @command{gawk}, predefined variables and
address@hidden @command{gawk} @subentry predefined variables and
This @value{SECTION} documents all of @command{gawk}'s predefined variables,
most of which are also documented in the @value{CHAPTER}s describing
their areas of activity.
@@ -15331,7 +15331,7 @@ their areas of activity.
@node User-modified
@subsection Built-in Variables That Control @command{awk}
address@hidden predefined variables, user-modifiable
address@hidden predefined variables @subentry user-modifiable
@cindex user-modifiable variables
The following is an alphabetical list of variables that you can change to
@@ -15346,8 +15346,8 @@ in the description of each variable.)
@table @code
@cindex @code{BINMODE} variable
@cindex binary input/output
address@hidden input/output, binary
address@hidden differences in @command{awk} and @command{gawk}, @code{BINMODE}
variable
address@hidden input/output @subentry binary
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{BINMODE} variable
@item BINMODE #
On non-POSIX systems, this variable specifies use of binary mode
for all I/O. Numeric values of one, two, or three specify that input
@@ -15363,9 +15363,9 @@ detail in @ref{PC Using}. @command{mawk} (@pxref{Other
Versions})
also supports this variable, but only using numeric values.
@cindex @code{CONVFMT} variable
address@hidden POSIX @command{awk}, @code{CONVFMT} variable and
address@hidden numbers, converting, to strings
address@hidden strings, converting, numbers to
address@hidden POSIX @command{awk} @subentry @code{CONVFMT} variable and
address@hidden numbers @subentry converting @subentry to strings
address@hidden strings @subentry converting @subentry numbers to
@item @code{CONVFMT}
A string that controls the conversion of numbers to
strings (@pxref{Conversion}).
@@ -15375,11 +15375,11 @@ It works by being passed, in effect, as the first
argument to the
Its default value is @code{"%.6g"}.
@code{CONVFMT} was introduced by the POSIX standard.
address@hidden @command{gawk}, @code{FIELDWIDTHS} variable in
address@hidden @command{gawk} @subentry @code{FIELDWIDTHS} variable in
@cindex @code{FIELDWIDTHS} variable
address@hidden differences in @command{awk} and @command{gawk},
@code{FIELDWIDTHS} variable
address@hidden field separators, @code{FIELDWIDTHS} variable and
address@hidden separators, field, @code{FIELDWIDTHS} variable and
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{FIELDWIDTHS} variable
address@hidden field separators @subentry @code{FIELDWIDTHS} variable and
address@hidden separators @subentry field @subentry @code{FIELDWIDTHS} variable
and
@item FIELDWIDTHS #
A space-separated list of columns that tells @command{gawk}
how to split input with fixed columnar boundaries.
@@ -15390,11 +15390,11 @@ Assigning a value to @code{FIELDWIDTHS}
overrides the use of @code{FS} and @code{FPAT} for field splitting.
@xref{Constant Size} for more information.
address@hidden @command{gawk}, @code{FPAT} variable in
address@hidden @command{gawk} @subentry @code{FPAT} variable in
@cindex @code{FPAT} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{FPAT}
variable
address@hidden field separators, @code{FPAT} variable and
address@hidden separators, field, @code{FPAT} variable and
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{FPAT} variable
address@hidden field separators @subentry @code{FPAT} variable and
address@hidden separators @subentry field @subentry @code{FPAT} variable and
@item FPAT #
A regular expression (as a string) that tells @command{gawk}
to create the fields based on text that matches the regular expression.
@@ -15403,7 +15403,7 @@ overrides the use of @code{FS} and @code{FIELDWIDTHS}
for field splitting.
@xref{Splitting By Content} for more information.
@cindex @code{FS} variable
address@hidden separators, field
address@hidden separators @subentry field
@cindex field separators
@item FS
The input field separator (@pxref{Field Separators}).
@@ -15429,19 +15429,19 @@ You can set the value of @code{FS} on the command
line using the
awk -F, '@var{program}' @var{input-files}
@end example
address@hidden @command{gawk}, field separators and
address@hidden @command{gawk} @subentry field separators and
If @command{gawk} is using @code{FIELDWIDTHS} or @code{FPAT}
for field splitting,
assigning a value to @code{FS} causes @command{gawk} to return to
the normal, @code{FS}-based field splitting. An easy way to do this
is to simply say @samp{FS = FS}, perhaps with an explanatory comment.
address@hidden @command{gawk}, @code{IGNORECASE} variable in
address@hidden @command{gawk} @subentry @code{IGNORECASE} variable in
@cindex @code{IGNORECASE} variable
address@hidden differences in @command{awk} and @command{gawk},
@code{IGNORECASE} variable
address@hidden case sensitivity, string comparisons and
address@hidden case sensitivity, regexps and
address@hidden regular expressions, case sensitivity
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{IGNORECASE} variable
address@hidden case sensitivity @subentry string comparisons and
address@hidden case sensitivity @subentry regexps and
address@hidden regular expressions @subentry case sensitivity
@item IGNORECASE #
If @code{IGNORECASE} is nonzero or non-null, then all string comparisons
and all regular expression matching are case-independent.
@@ -15456,9 +15456,9 @@ and it does not affect field splitting when using a
single-character
field separator.
@xref{Case-sensitivity}.
address@hidden @command{gawk}, @code{LINT} variable in
address@hidden @command{gawk} @subentry @code{LINT} variable in
@cindex @code{LINT} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{LINT}
variable
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{LINT} variable
@cindex lint checking
@item LINT #
When this variable is true (nonzero or non-null), @command{gawk}
@@ -15480,8 +15480,8 @@ of lint warnings during program execution is
independent of the flavor
of @command{awk} being executed.
@cindex @code{OFMT} variable
address@hidden numbers, converting, to strings
address@hidden strings, converting, numbers to
address@hidden numbers @subentry converting @subentry to strings
address@hidden strings @subentry converting @subentry numbers to
@item OFMT
A string that controls conversion of numbers to
strings (@pxref{Conversion}) for
@@ -15492,9 +15492,9 @@ Its default value is @code{"%.6g"}. Earlier versions
of @command{awk}
used @code{OFMT} to specify the format for converting numbers to
strings in general expressions; this is now done by @code{CONVFMT}.
address@hidden @code{print} statement, @code{OFMT} variable and
address@hidden @code{print} statement @subentry @code{OFMT} variable and
@cindex @code{OFS} variable
address@hidden separators, field
address@hidden separators @subentry field
@cindex field separators
@item OFS
The output field separator (@pxref{Output Separators}). It is
@@ -15519,7 +15519,7 @@ numbers, by default @code{"N"} (@code{roundTiesToEven}
in
the IEEE 754 standard; @pxref{Setting the rounding mode}).
@cindex @code{RS} variable
address@hidden separators, for records
address@hidden separators @subentry for records
@cindex record separators
@item @code{RS}
The input record separator. Its default value is a string
@@ -15539,7 +15539,7 @@ or if @command{gawk} is in compatibility mode
just the first character of @code{RS}'s value is used.
@cindex @code{SUBSEP} variable
address@hidden separators, subscript
address@hidden separators @subentry subscript
@cindex subscript separators
@item @code{SUBSEP}
The subscript separator. It has the default value of
@@ -15548,10 +15548,10 @@ multidimensional array. Thus, the expression
@address@hidden"A", "B"]}}
really accesses @code{foo["A\034B"]}
(@pxref{Multidimensional}).
address@hidden @command{gawk}, @code{TEXTDOMAIN} variable in
address@hidden @command{gawk} @subentry @code{TEXTDOMAIN} variable in
@cindex @code{TEXTDOMAIN} variable
address@hidden differences in @command{awk} and @command{gawk},
@code{TEXTDOMAIN} variable
address@hidden internationalization, localization
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{TEXTDOMAIN} variable
address@hidden internationalization @subentry localization
@item TEXTDOMAIN #
Used for internationalization of programs at the
@command{awk} level. It sets the default text domain for specially
@@ -15564,8 +15564,8 @@ The default value of @code{TEXTDOMAIN} is
@code{"messages"}.
@node Auto-set
@subsection Built-in Variables That Convey Information
address@hidden predefined variables, conveying information
address@hidden variables, predefined, conveying information
address@hidden predefined variables @subentry conveying information
address@hidden variables @subentry predefined @subentry conveying information
The following is an alphabetical list of variables that @command{awk}
sets automatically on certain occasions in order to provide
information to your program.
@@ -15578,8 +15578,8 @@ mode (@pxref{Options}), they are not special:
@c @asis for docbook
@table @asis
@cindex @code{ARGC}/@code{ARGV} variables
address@hidden arguments, command-line
address@hidden command line, arguments
address@hidden arguments @subentry command-line
address@hidden command line @subentry arguments
@item @code{ARGC}, @code{ARGV}
The command-line arguments available to @command{awk} programs are stored in
an array called @code{ARGV}. @code{ARGC} is the number of command-line
@@ -15607,12 +15607,12 @@ contains @samp{inventory-shipped}, and @code{ARGV[2]}
contains
index of the last element in @code{ARGV}, because the elements are numbered
from zero.
address@hidden programming conventions, @code{ARGC}/@code{ARGV} variables
address@hidden programming conventions @subentry @code{ARGC}/@code{ARGV}
variables
The names @code{ARGC} and @code{ARGV}, as well as the convention of indexing
the array from 0 to @code{ARGC} @minus{} 1, are derived from the C language's
method of accessing command-line arguments.
address@hidden dark corner, value of @code{ARGV[0]}
address@hidden dark corner @subentry value of @code{ARGV[0]}
The value of @code{ARGV[0]} can vary from system to system.
Also, you should note that the program text is @emph{not} included in
@code{ARGV}, nor are any of @command{awk}'s command-line options.
@@ -15621,7 +15621,7 @@ about how @command{awk} uses these variables.
@value{DARKCORNER}
@cindex @code{ARGIND} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{ARGIND}
variable
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{ARGIND} variable
@item @code{ARGIND #}
The index in @code{ARGV} of the current file being processed.
Every time @command{gawk} opens a new @value{DF} for processing, it sets
@@ -15629,12 +15629,12 @@ Every time @command{gawk} opens a new @value{DF} for
processing, it sets
When @command{gawk} is processing the input files,
@samp{FILENAME == ARGV[ARGIND]} is always true.
address@hidden files, address@hidden @code{ARGIND} variable and
address@hidden files @subentry processing, @code{ARGIND} variable and
This variable is useful in file processing; it allows you to tell how far
along you are in the list of @value{DF}s as well as to distinguish between
successive instances of the same @value{FN} on the command line.
address@hidden file names, distinguishing
address@hidden file names @subentry distinguishing
While you can change the value of @code{ARGIND} within your @command{awk}
program, @command{gawk} automatically sets it to a new value when it
opens the next file.
@@ -15676,9 +15676,9 @@ On such systems, the @code{ENVIRON} array is empty
(except for
@pxref{AWKLIBPATH Variable}).
@end ifnotdocbook
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @command{gawk} @subentry @code{ERRNO} variable in
@cindex @code{ERRNO} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{ERRNO}
variable
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{ERRNO} variable
@cindex error handling, @code{ERRNO} variable and
@item @code{ERRNO #}
If a system error occurs during a redirection for @code{getline}, during
@@ -15702,7 +15702,7 @@ of @code{errno}. For non-system errors,
@code{PROCINFO["errno"]} will
be zero.
@cindex @code{FILENAME} variable
address@hidden dark corner, @code{FILENAME} variable
address@hidden dark corner @subentry @code{FILENAME} variable
@item @code{FILENAME}
The name of the current input file. When no @value{DF}s are listed
on the command line, @command{awk} reads from the standard input and
@@ -15736,8 +15736,8 @@ to @code{NF} can be used to create fields in or remove
fields from the
current record. @xref{Changing Fields}.
@cindex @code{FUNCTAB} array
address@hidden @command{gawk}, @code{FUNCTAB} array in
address@hidden differences in @command{awk} and @command{gawk}, @code{FUNCTAB}
variable
address@hidden @command{gawk} @subentry @code{FUNCTAB} array in
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{FUNCTAB} variable
@item @code{FUNCTAB #}
An array whose indices and corresponding values are the names of all
the built-in, user-defined, and extension functions in the program.
@@ -15755,9 +15755,9 @@ the beginning of the program's execution
(@pxref{Records}).
@command{awk} increments @code{NR} each time it reads a new record.
address@hidden @command{gawk}, @code{PROCINFO} array in
address@hidden @command{gawk} @subentry @code{PROCINFO} array in
@cindex @code{PROCINFO} array
address@hidden differences in @command{awk} and @command{gawk}, @code{PROCINFO}
array
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{PROCINFO} array
@item @code{PROCINFO #}
The elements of this array provide access to information about the
running @command{awk} program.
@@ -15766,7 +15766,7 @@ are guaranteed to be available:
@table @code
@item PROCINFO["argv"]
address@hidden command line, arguments
address@hidden command line @subentry arguments
The @code{PROCINFO["argv"]} array contains all of the command-line arguments
(after glob expansion and redirection processing on platforms where that must
be done manually by the program) with subscripts ranging from 0 through
@@ -15925,7 +15925,7 @@ of @command{gawk} supports dynamic loading of extension
functions
@table @code
@item PROCINFO["api_major"]
@cindex version of @command{gawk} extension API
address@hidden extension API, version number
address@hidden extension API @subentry version number
The major version of the extension API.
@item PROCINFO["api_minor"]
@@ -15997,16 +15997,16 @@ The start index in characters of the substring that
is matched by the
is the position of the string where the matched substring starts, or zero
if no match was found.
address@hidden @command{gawk}, @code{RT} variable in
address@hidden @command{gawk} @subentry @code{RT} variable in
@cindex @code{RT} variable
address@hidden differences in @command{awk} and @command{gawk},
@code{RS}/@code{RT} variables
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{RS}/@code{RT} variables
@item @code{RT #}
The input text that matched the text denoted by @code{RS},
the record separator. It is set every time a record is read.
address@hidden @command{gawk}, @code{SYMTAB} array in
address@hidden @command{gawk} @subentry @code{SYMTAB} array in
@cindex @code{SYMTAB} array
address@hidden differences in @command{awk} and @command{gawk}, @code{SYMTAB}
variable
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{SYMTAB} variable
@item @code{SYMTAB #}
An array whose indices are the names of all defined global variables and
arrays in the program. @code{SYMTAB} makes @command{gawk}'s symbol table
@@ -16082,7 +16082,7 @@ is available as an element within the @code{SYMTAB}
array.
@end quotation
@end table
address@hidden sidebar, Changing @code{NR} and @code{FNR}
address@hidden sidebar @subentry Changing @code{NR} and @code{FNR}
@ifdocbook
@docbook
<sidebar><title>Changing @code{NR} and @code{FNR}</title>
@@ -16090,7 +16090,7 @@ is available as an element within the @code{SYMTAB}
array.
@cindex @code{NR} variable, changing
@cindex @code{FNR} variable, changing
address@hidden dark corner, @code{FNR}/@code{NR} variables
address@hidden dark corner @subentry @code{FNR}/@code{NR} variables
@command{awk} increments @code{NR} and @code{FNR}
each time it reads a record, instead of setting them to the absolute
value of the number of records read. This means that a program can
@@ -16130,7 +16130,7 @@ changed.
@cindex @code{NR} variable, changing
@cindex @code{FNR} variable, changing
address@hidden dark corner, @code{FNR}/@code{NR} variables
address@hidden dark corner @subentry @code{FNR}/@code{NR} variables
@command{awk} increments @code{NR} and @code{FNR}
each time it reads a record, instead of setting them to the absolute
value of the number of records read. This means that a program can
@@ -16162,9 +16162,9 @@ changed.
@node ARGC and ARGV
@subsection Using @code{ARGC} and @code{ARGV}
address@hidden @code{ARGC}/@code{ARGV} variables, how to use
address@hidden arguments, command-line
address@hidden command line, arguments
address@hidden @code{ARGC}/@code{ARGV} variables @subentry how to use
address@hidden arguments @subentry command-line
address@hidden command line @subentry arguments
@ref{Auto-set}
presented the following program describing the information contained in
@code{ARGC}
@@ -16277,7 +16277,7 @@ BEGIN @{
@}
@end example
address@hidden differences in @command{awk} and @command{gawk},
@code{ARGC}/@code{ARGV} variables
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{ARGC}/@code{ARGV} variables
Ending the @command{awk} options with @option{--} isn't
necessary in @command{gawk}. Unless @option{--posix} has
been specified, @command{gawk} silently puts any unrecognized options
@@ -16493,10 +16493,10 @@ Only the values are stored; the indices are implicit
from the order of
the values. Here, eight is the value at index zero, because eight appears in
the
position with zero elements before it.
address@hidden arrays, indexing
address@hidden arrays @subentry indexing
@cindex indexing arrays
@cindex associative arrays
address@hidden arrays, associative
address@hidden arrays @subentry associative
Arrays in @command{awk} are different---they are @dfn{associative}. This means
that each array is a collection of pairs---an index and its corresponding
array element value:
@@ -16619,7 +16619,7 @@ whose value is @address@hidden"number ten"}}. The
result is:
@noindent
@cindex sparse arrays
address@hidden arrays, sparse
address@hidden arrays @subentry sparse
Now the array is @dfn{sparse}, which just means some indices are missing.
It has elements 0--3 and 10, but doesn't have elements 4, 5, 6, 7, 8, or 9.
@@ -16687,10 +16687,10 @@ array subscripts; this is discussed in more detail in
Here, the number @code{1} isn't double-quoted, because @command{awk}
automatically converts it to a string.
address@hidden @command{gawk}, @code{IGNORECASE} variable in
address@hidden case sensitivity, array indices and
address@hidden arrays, @code{IGNORECASE} variable and
address@hidden @code{IGNORECASE} variable, array indices and
address@hidden @command{gawk} @subentry @code{IGNORECASE} variable in
address@hidden case sensitivity @subentry array indices and
address@hidden arrays @subentry @code{IGNORECASE} variable and
address@hidden @code{IGNORECASE} variable @subentry array indices and
The value of @code{IGNORECASE} has no effect upon array subscripting.
The identical string value used to store an array element must be used
to retrieve it.
@@ -16704,7 +16704,7 @@ is independent of the number of elements in the array.
@node Reference to Elements
@subsection Referring to an Array Element
address@hidden arrays, referencing elements
address@hidden arrays @subentry referencing elements
@cindex array members
@cindex elements of arrays
@@ -16726,7 +16726,7 @@ The value of the array reference is the current value
of that array
element. For example, @code{foo[4.3]} is an expression referencing the element
of array @code{foo} at index @samp{4.3}.
address@hidden arrays, unassigned elements
address@hidden arrays @subentry unassigned elements
@cindex unassigned array elements
@cindex empty array elements
A reference to an array element that has no recorded value yields a value of
@@ -16735,7 +16735,7 @@ that have not been assigned any value as well as
elements that have been
deleted (@pxref{Delete}).
@cindex non-existent array elements
address@hidden arrays, elements that don't exist
address@hidden arrays @subentry elements that don't exist
@quotation NOTE
A reference to an element that does not exist @emph{automatically} creates
that array element, with the null string as its value. (In some cases,
@@ -16756,7 +16756,7 @@ an array element equal to the empty string.
@end quotation
@c @cindex arrays, @code{in} operator and
address@hidden @code{in} operator, testing if array element exists
address@hidden @code{in} operator @subentry testing if array element exists
To determine whether an element exists in an array at a certain index, use
the following expression:
@@ -16764,7 +16764,7 @@ the following expression:
@var{indx} in @var{array}
@end example
address@hidden side effects, array indexing
address@hidden side effects @subentry array indexing
@noindent
This expression tests whether the particular index @var{indx} exists,
without the side effect of creating that element if it is not present.
@@ -16797,8 +16797,8 @@ if (frequencies[2] != "")
@node Assigning Elements
@subsection Assigning Array Elements
address@hidden arrays, elements, assigning values
address@hidden elements in arrays, assigning values
address@hidden arrays @subentry elements @subentry assigning values
address@hidden elements in arrays @subentry assigning values
Array elements can be assigned values just like
@command{awk} variables:
@@ -16815,7 +16815,7 @@ assign to that element of the array.
@node Array Example
@subsection Basic Array Example
address@hidden arrays, an example of using
address@hidden arrays @subentry an example of using
The following program takes a list of lines, each beginning with a line
number, and prints them out in order of line number. The line numbers
@@ -16890,10 +16890,10 @@ END @{
@node Scanning an Array
@subsection Scanning All Elements of an Array
address@hidden elements in arrays, scanning
address@hidden elements in arrays @subentry scanning
@cindex scanning arrays
address@hidden arrays, scanning
address@hidden loops, @code{for}, array scanning
address@hidden arrays @subentry scanning
address@hidden loops @subentry @code{for} @subentry array scanning
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
@@ -16912,11 +16912,11 @@ for (@var{var} in @var{array})
@end example
@noindent
address@hidden @code{in} operator, use in loops
address@hidden @code{in} operator @subentry use in loops
This loop executes @var{body} once for each index in @var{array} that the
program has previously used, with the variable @var{var} set to that index.
address@hidden arrays, @code{for} statement and
address@hidden arrays @subentry @code{for} statement and
@cindex @code{for} statement, looping over arrays
The following program uses this form of the @code{for} statement. The
first rule scans the input records and notes which words appear (at
@@ -16955,9 +16955,9 @@ END @{
@xref{Word Sorting}
for a more detailed example of this type.
address@hidden arrays, elements, order of access by @code{in} operator
address@hidden elements in arrays, order of access by @code{in} operator
address@hidden @code{in} operator, order of array access
address@hidden arrays @subentry elements @subentry order of access by @code{in}
operator
address@hidden elements in arrays @subentry order of access by @code{in}
operator
address@hidden @code{in} operator @subentry order of array access
The order in which elements of the array are accessed by this statement
is determined by the internal arrangement of the array elements within
@command{awk} and in standard @command{awk} cannot be controlled
@@ -17035,7 +17035,7 @@ to use for comparison of array elements. This advanced
feature
is described later in @ref{Array Sorting}.
@end itemize
address@hidden @code{PROCINFO}, values of @code{sorted_in}
address@hidden @code{PROCINFO} @subentry values of @code{sorted_in}
The following special values for @code{PROCINFO["sorted_in"]} are available:
@table @code
@@ -17170,10 +17170,10 @@ sorting arrays; see @ref{Array Sorting Functions}.
@node Numeric Array Subscripts
@section Using Numbers to Subscript Arrays
address@hidden numbers, as array subscripts
address@hidden array subscripts, numbers as
address@hidden arrays, numeric subscripts
address@hidden subscripts in arrays, numbers as
address@hidden numbers @subentry as array subscripts
address@hidden array subscripts @subentry numbers as
address@hidden arrays @subentry numeric subscripts
address@hidden subscripts in arrays @subentry numbers as
@cindex @code{CONVFMT} variable, array subscripts and
An important aspect to remember about arrays is that @emph{array subscripts
are always strings}. When a numeric value is used as a subscript,
@@ -17238,10 +17238,10 @@ effect on your programs.
@node Uninitialized Subscripts
@section Using Uninitialized Variables as Subscripts
address@hidden variables, address@hidden as array subscripts
address@hidden variables @subentry uninitialized, as array subscripts
@cindex uninitialized variables, as array subscripts
address@hidden subscripts in arrays, uninitialized variables as
address@hidden arrays, subscripts, uninitialized variables as
address@hidden subscripts in arrays @subentry uninitialized variables as
address@hidden arrays @subentry subscripts @subentry uninitialized variables as
Suppose it's necessary to write a program
to print the input data in reverse order.
A reasonable attempt to do so (with some test
@@ -17285,10 +17285,10 @@ Here, the @samp{++} forces @code{lines} to be
numeric, thus making
the ``old value'' numeric zero. This is then converted to @code{"0"}
as the array subscript.
address@hidden array subscripts, null strings as
address@hidden null strings, as array subscripts
address@hidden dark corner, array subscripts
address@hidden lint checking, array subscripts
address@hidden array subscripts @subentry null strings as
address@hidden null strings @subentry as array subscripts
address@hidden dark corner @subentry array subscripts
address@hidden lint checking @subentry array subscripts
Even though it is somewhat unusual, the null string
(@code{""}) is a valid array subscript.
@value{DARKCORNER}
@@ -17300,8 +17300,8 @@ on the command line (@pxref{Options}).
@section The @code{delete} Statement
@cindex @code{delete} statement
@cindex deleting elements in arrays
address@hidden arrays, elements, deleting
address@hidden elements in arrays, deleting
address@hidden arrays @subentry elements @subentry deleting
address@hidden elements in arrays @subentry deleting
To remove an individual element of an array, use the @code{delete}
statement:
@@ -17332,7 +17332,7 @@ if (4 in foo)
print "This will never be printed"
@end example
address@hidden null strings, deleting array elements and
address@hidden null strings @subentry deleting array elements and
It is important to note that deleting an element is @emph{not} the
same as assigning it a null value (the empty string, @code{""}).
For example:
@@ -17345,19 +17345,19 @@ if (4 in foo)
@end group
@end example
address@hidden lint checking, array elements
address@hidden lint checking @subentry array elements
It is not an error to delete an element that does not exist.
However, if @option{--lint} is provided on the command line
(@pxref{Options}),
@command{gawk} issues a warning message when an element that
is not in the array is deleted.
address@hidden common extensions, @code{delete} to delete entire arrays
address@hidden extensions, address@hidden @code{delete} to delete entire arrays
address@hidden arrays, deleting entire contents
address@hidden common extensions @subentry @code{delete} to delete entire arrays
address@hidden extensions @subentry common, @code{delete} to delete entire
arrays
address@hidden arrays @subentry deleting entire contents
@cindex deleting entire arrays
@cindex @code{delete} @var{array}
address@hidden differences in @command{awk} and @command{gawk}, array elements,
deleting
address@hidden differences in @command{awk} and @command{gawk} @subentry array
elements @subentry deleting
All the elements of an array may be deleted with a single statement
by leaving off the subscript in the @code{delete} statement,
as follows:
@@ -17383,7 +17383,7 @@ POSIX standard. See
@uref{http://austingroupbugs.net/view.php?id=544,
the Austin Group website}.
@end quotation
address@hidden portability, deleting array elements
address@hidden portability @subentry deleting array elements
@cindex Brennan, Michael
The following statement provides a portable but nonobvious way to clear
out an array:@footnote{Thanks to Michael Brennan for pointing this out.}
@@ -17418,8 +17418,8 @@ a = 3
* Multiscanning:: Scanning multidimensional arrays.
@end menu
address@hidden subscripts in arrays, multidimensional
address@hidden arrays, multidimensional
address@hidden subscripts in arrays @subentry multidimensional
address@hidden arrays @subentry multidimensional
A @dfn{multidimensional array} is an array in which an element is identified
by a sequence of indices instead of a single index. For example, a
two-dimensional array requires two indices. The usual way (in many
@@ -17459,7 +17459,7 @@ combined strings that are ambiguous. Suppose that
@code{SUBSEP} is
"b@@c"]}} are indistinguishable because both are actually
stored as @samp{foo["a@@b@@c"]}.
address@hidden @code{in} operator, index existence in multidimensional arrays
address@hidden @code{in} operator @subentry index existence in multidimensional
arrays
To test whether a particular index sequence exists in a
multidimensional array, use the same operator (@code{in}) that is
used for single-dimensional arrays. Write the whole sequence of indices
@@ -17528,8 +17528,8 @@ There is no special @code{for} statement for scanning a
multidimensional arrays or elements---there is only a
multidimensional @emph{way of accessing} an array.
address@hidden subscripts in arrays, multidimensional, scanning
address@hidden arrays, multidimensional, scanning
address@hidden subscripts in arrays @subentry multidimensional @subentry
scanning
address@hidden arrays @subentry multidimensional @subentry scanning
@cindex scanning multidimensional arrays
However, if your program has an array that is always accessed as
multidimensional, you can get the effect of scanning it by combining
@@ -17794,7 +17794,7 @@ element is itself a subarray.
@node Functions
@chapter Functions
address@hidden functions, built-in
address@hidden functions @subentry built-in
@cindex built-in functions
This @value{CHAPTER} describes @command{awk}'s built-in functions,
which fall into three categories: numeric, string, and I/O.
@@ -17848,17 +17848,17 @@ the function followed
by arguments in parentheses. For example, @samp{atan2(y + z, 1)}
is a call to the function @code{atan2()} and has two arguments.
address@hidden programming conventions, functions, calling
address@hidden whitespace, address@hidden calling
address@hidden programming conventions @subentry functions @subentry calling
address@hidden whitespace @subentry functions, calling
Whitespace is ignored between the built-in function name and the
opening parenthesis, but nonetheless it is good practice to avoid using
whitespace
there. User-defined functions do not permit whitespace in this way, and
it is easier to avoid mistakes by following a simple
convention that always works---no whitespace after a function name.
address@hidden troubleshooting, @command{gawk}, fatal address@hidden function
arguments
address@hidden @command{gawk}, function arguments and
address@hidden differences in @command{awk} and @command{gawk}, function
arguments (@command{gawk})
address@hidden troubleshooting @subentry @command{gawk} @subentry fatal errors,
function arguments
address@hidden @command{gawk} @subentry function arguments and
address@hidden differences in @command{awk} and @command{gawk} @subentry
function arguments (@command{gawk})
Each built-in function accepts a certain number of arguments.
In some cases, arguments can be omitted. The defaults for omitted
arguments vary from function to function and are described under the
@@ -17875,8 +17875,8 @@ i = 4
j = sqrt(i++)
@end example
address@hidden evaluation order, functions
address@hidden functions, built-in, evaluation order
address@hidden evaluation order @subentry functions
address@hidden functions @subentry built-in @subentry evaluation order
@cindex built-in functions, evaluation order
@noindent
the variable @code{i} is incremented to the value five before @code{sqrt()}
@@ -17968,7 +17968,7 @@ is negative.
@cindex Beebe, Nelson H.F.@:
@item @code{rand()}
@cindexawkfunc{rand}
address@hidden random numbers, @code{rand()}/@code{srand()} functions
address@hidden random numbers @subentry @code{rand()}/@code{srand()} functions
Return a random number. The values of @code{rand()} are
uniformly distributed between zero and one.
The value could be zero but is never address@hidden C version of
@@ -18014,7 +18014,7 @@ function roll(n) @{ return 1 + int(rand() * n) @}
@end example
@cindex seeding random number generator
address@hidden random numbers, seed of
address@hidden random numbers @subentry seed of
@quotation CAUTION
In most @command{awk} implementations, including @command{gawk},
@code{rand()} starts generating numbers from the same
@@ -18117,7 +18117,7 @@ pound sign (@samp{#}). They are not available in
compatibility mode
@itemx @code{asorti(address@hidden address@hidden,} @var{dest}
address@hidden,} @var{how} ] address@hidden) #}
@cindexgawkfunc{asorti}
@cindex sort array
address@hidden arrays, elements, retrieving number of
address@hidden arrays @subentry elements @subentry retrieving number of
@cindexgawkfunc{asort}
@cindex sort array indices
These two functions are similar in behavior, so they are described
@@ -18137,7 +18137,7 @@ sequential integers starting with one. If the optional
array @var{dest}
is specified, then @var{source} is duplicated into @var{dest}. @var{dest}
is then sorted, leaving the indices of @var{source} unchanged.
address@hidden @command{gawk}, @code{IGNORECASE} variable in
address@hidden @command{gawk} @subentry @code{IGNORECASE} variable in
When comparing strings, @code{IGNORECASE} affects the sorting
(@pxref{Array Sorting Functions}). If the
@var{source} array contains subarrays as values (@pxref{Arrays of
@@ -18282,7 +18282,7 @@ $ @kbd{awk 'BEGIN @{ print index("peanut", "an") @}'}
@noindent
If @var{find} is not found, @code{index()} returns zero.
address@hidden dark corner, regexp as second argument to @code{index()}
address@hidden dark corner @subentry regexp as second argument to @code{index()}
With BWK @command{awk} and @command{gawk},
it is a fatal error to use a regexp constant for @var{find}.
Other implementations allow it, simply treating the regexp
@@ -18311,12 +18311,12 @@ and 525 is then converted to the string @code{"525"},
which has
three characters.
@cindex length of input record
address@hidden input record, length of
address@hidden input record @subentry length of
If no argument is supplied, @code{length()} returns the length of @code{$0}.
@c @cindex historical features
address@hidden portability, @code{length()} function
address@hidden POSIX @command{awk}, functions and, @code{length()}
address@hidden portability @subentry @code{length()} function
address@hidden POSIX @command{awk} @subentry functions and @subentry
@code{length()}
@quotation NOTE
In older versions of @command{awk}, the @code{length()} function could
be called
@@ -18326,7 +18326,7 @@ support historical practice. For programs to be
maximally portable,
always supply the parentheses.
@end quotation
address@hidden dark corner, @code{length()} function
address@hidden dark corner @subentry @code{length()} function
If @code{length()} is called with a variable that has not been used,
@command{gawk} forces the variable to be a scalar. Other
implementations of @command{awk} leave the variable without a type.
@@ -18347,9 +18347,9 @@ If @option{--lint} has
been specified on the command line, @command{gawk} issues a
warning about this.
address@hidden common extensions, @code{length()} applied to an array
address@hidden extensions, address@hidden @code{length()} applied to an array
address@hidden differences in @command{awk} and @command{gawk}, @code{length()}
function
address@hidden common extensions @subentry @code{length()} applied to an array
address@hidden extensions @subentry common, @code{length()} applied to an array
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{length()} function
@cindex number of array elements
@cindex array, number of elements
With @command{gawk} and several other @command{awk} implementations, when
given an
@@ -18437,7 +18437,7 @@ Match of ru+n found at 12 in My program runs
Match of Melvin found at 1 in Melvin was here.
@end example
address@hidden differences in @command{awk} and @command{gawk}, @code{match()}
function
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{match()} function
If @var{array} is present, it is cleared, and then the zeroth element
of @var{array} is set to the entire portion of @var{string}
matched by @var{regexp}. If @var{regexp} contains parentheses,
@@ -18474,7 +18474,7 @@ subexpression, because they may not all have matched
text; thus, they
should be tested for with the @code{in} operator
(@pxref{Reference to Elements}).
address@hidden troubleshooting, @code{match()} function
address@hidden troubleshooting @subentry @code{match()} function
The @var{array} argument to @code{match()} is a
@command{gawk} extension. In compatibility mode
(@pxref{Options}),
@@ -18537,7 +18537,7 @@ split("cul-de-sac", a, "-", seps)
@end example
@noindent
address@hidden strings splitting, example
address@hidden strings splitting @subentry example
splits the string @code{"cul-de-sac"} into three fields using @samp{-} as the
separator. It sets the contents of the array @code{a} as follows:
@@ -18557,7 +18557,7 @@ seps[2] = "-"
@noindent
The value returned by this call to @code{split()} is three.
address@hidden differences in @command{awk} and @command{gawk}, @code{split()}
function
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{split()} function
As with input field-splitting, when the value of @var{fieldsep} is
@address@hidden" "}}, leading and trailing whitespace is ignored in values
assigned to
the elements of
@@ -18573,7 +18573,7 @@ Note, however, that @code{RS} has no effect on the way
@code{split()}
works. Even though @samp{RS = ""} causes the newline character to also be an
input
field separator, this does not affect how @code{split()} splits strings.
address@hidden dark corner, @code{split()} function
address@hidden dark corner @subentry @code{split()} function
Modern implementations of @command{awk}, including @command{gawk}, allow
the third argument to be a regexp constant
(@address@hidden/address@hidden@code{/}})
as well as a string. @value{DARKCORNER}
@@ -18710,8 +18710,8 @@ an @samp{&}:
@{ sub(/\|/, "\\&"); print @}
@end example
address@hidden @code{sub()} function, arguments of
address@hidden @code{gsub()} function, arguments of
address@hidden @code{sub()} function @subentry arguments of
address@hidden @code{gsub()} function @subentry arguments of
As mentioned, the third argument to @code{sub()} must
be a variable, field, or array element.
Some versions of @command{awk} allow the third argument to
@@ -18726,7 +18726,7 @@ sub(/USA/, "United States", "the USA and Canada")
@end example
@noindent
address@hidden troubleshooting, @code{gsub()}/@code{sub()} functions
address@hidden troubleshooting @subentry @code{gsub()}/@code{sub()} functions
For historical compatibility, @command{gawk} accepts such erroneous code.
However, using any other nonchangeable
object as the third parameter causes a fatal error and your program
@@ -18761,7 +18761,7 @@ in the string, @code{substr()} returns the null string.
Similarly, if @var{length} is present but less than or equal to zero,
the null string is returned.
address@hidden troubleshooting, @code{substr()} function
address@hidden troubleshooting @subentry @code{substr()} function
The string returned by @code{substr()} @emph{cannot} be
assigned. Thus, it is a mistake to attempt to change a portion of
a string, as shown in the following example:
@@ -18780,7 +18780,7 @@ of @code{sub()} or @code{gsub()}:
gsub(/xyz/, "pdq", substr($0, 5, 20)) # WRONG
@end example
address@hidden portability, @code{substr()} function
address@hidden portability @subentry @code{substr()} function
(Some commercial versions of @command{awk} treat
@code{substr()} as assignable, but doing so is not portable.)
@@ -18793,8 +18793,8 @@ string = "abcdef"
string = substr(string, 1, 2) "CDE" substr(string, 6)
@end example
address@hidden case sensitivity, converting case
address@hidden strings, converting letter case
address@hidden case sensitivity @subentry converting case
address@hidden strings @subentry converting letter case
@item @code{tolower(@var{string})}
@cindexawkfunc{tolower}
@cindex convert string to lower case
@@ -18812,16 +18812,16 @@ Nonalphabetic characters are left unchanged. For
example,
@code{toupper("MiXeD cAsE 123")} returns @code{"MIXED CASE 123"}.
@end table
address@hidden sidebar, Matching the Null String
address@hidden sidebar @subentry Matching the Null String
@ifdocbook
@docbook
<sidebar><title>Matching the Null String</title>
@end docbook
address@hidden matching, null strings
address@hidden null strings, matching
address@hidden @code{*} (asterisk), @code{*} operator, null address@hidden
matching
address@hidden asterisk (@code{*}), @code{*} operator, null address@hidden
matching
address@hidden matching @subentry null strings
address@hidden null strings @subentry matching
address@hidden @code{*} (asterisk) @subentry @code{*} operator @subentry null
strings, matching
address@hidden asterisk (@code{*}) @subentry @code{*} operator @subentry null
strings, matching
In @command{awk}, the @samp{*} operator can match the null string.
This is particularly important for the @code{sub()}, @code{gsub()},
@@ -18845,10 +18845,10 @@ Although this makes a certain amount of sense, it can
be surprising.
@center @b{Matching the Null String}
address@hidden matching, null strings
address@hidden null strings, matching
address@hidden @code{*} (asterisk), @code{*} operator, null address@hidden
matching
address@hidden asterisk (@code{*}), @code{*} operator, null address@hidden
matching
address@hidden matching @subentry null strings
address@hidden null strings @subentry matching
address@hidden @code{*} (asterisk) @subentry @code{*} operator @subentry null
strings, matching
address@hidden asterisk (@code{*}) @subentry @code{*} operator @subentry null
strings, matching
In @command{awk}, the @samp{*} operator can match the null string.
This is particularly important for the @code{sub()}, @code{gsub()},
@@ -18868,14 +18868,14 @@ Although this makes a certain amount of sense, it can
be surprising.
@node Gory Details
@subsubsection More about @samp{\} and @samp{&} with @code{sub()},
@code{gsub()}, and @code{gensub()}
address@hidden escape processing, @code{gsub()}/@code{gensub()}/@code{sub()}
functions
address@hidden @code{sub()} function, escape processing
address@hidden @code{gsub()} function, escape processing
address@hidden escape processing @subentry
@code{gsub()}/@code{gensub()}/@code{sub()} functions
address@hidden @code{sub()} function @subentry escape processing
address@hidden @code{gsub()} function @subentry escape processing
@cindex @code{gensub()} function (@command{gawk}), escape processing
address@hidden @code{\} (backslash), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden backslash (@code{\}), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden @code{&} (ampersand), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden ampersand (@code{&}), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden @code{\} (backslash) @subentry
@code{gsub()}/@code{gensub()}/@code{sub()} functions and
address@hidden backslash (@code{\}) @subentry
@code{gsub()}/@code{gensub()}/@code{sub()} functions and
address@hidden @code{&} (ampersand) @subentry
@code{gsub()}/@code{gensub()}/@code{sub()} functions and
address@hidden ampersand (@code{&}) @subentry
@code{gsub()}/@code{gensub()}/@code{sub()} functions and
@quotation CAUTION
This subsubsection has been reported to cause headaches.
@@ -19041,7 +19041,7 @@ was expected. In addition, the @command{gawk}
maintainer's proposal was
lost during the standardization process. The final rules are
somewhat simpler. The results are similar except for one case.
address@hidden POSIX @command{awk}, functions and, @code{gsub()}/@code{sub()}
address@hidden POSIX @command{awk} @subentry functions and @subentry
@code{gsub()}/@code{sub()}
The POSIX rules state that @samp{\&} in the replacement string produces
a literal @samp{&}, @samp{\\} produces a literal @samp{\}, and @samp{\}
followed
by anything else is not special; the @samp{\} is placed straight into the
output.
@@ -19179,7 +19179,7 @@ Optional parameters are enclosed in square brackets ([
]):
@table @asis
@item @code{close(address@hidden address@hidden,} @address@hidden)}
@cindexawkfunc{close}
address@hidden files, closing
address@hidden files @subentry closing
@cindex close file or coprocess
Close the file @var{filename} for input or output. Alternatively, the
argument may be a shell command that was used for creating a coprocess, or
@@ -19207,8 +19207,8 @@ Flush any buffered output associated with
@var{filename}, which is either a
file opened for writing or a shell command for redirecting output to
a pipe or coprocess.
address@hidden buffers, flushing
address@hidden output, buffering
address@hidden buffers @subentry flushing
address@hidden output @subentry buffering
Many utility programs @dfn{buffer} their output (i.e., they save information
to write to a disk file or the screen in memory until there is enough
for it to be worthwhile to send the data to the output device).
@@ -19220,7 +19220,7 @@ This is the purpose of the @code{fflush()}
address@hidden also
buffers its output, and the @code{fflush()} function forces
@command{gawk} to flush its buffers.
address@hidden extensions, address@hidden @code{fflush()} function
address@hidden extensions @subentry common, @code{fflush()} function
@cindex Brian Kernighan's @command{awk}
Brian Kernighan added @code{fflush()} to his @command{awk} in April
1992. For two decades, it was a common extension. In December
@@ -19247,7 +19247,7 @@ only the standard output.
@c @cindex automatic warnings
@c @cindex warnings, automatic
address@hidden troubleshooting, @code{fflush()} function
address@hidden troubleshooting @subentry @code{fflush()} function
@code{fflush()} returns zero if the buffer is successfully flushed;
otherwise, it returns a nonzero value. (@command{gawk} returns @minus{}1.)
In the case where all buffers are flushed, the return value is zero
@@ -19262,13 +19262,13 @@ In such a case, @code{fflush()} returns @minus{}1, as
well.
@c end the table to let the sidebar take up the full width of the page.
@end table
address@hidden sidebar, Interactive Versus Noninteractive Buffering
address@hidden sidebar @subentry Interactive Versus Noninteractive Buffering
@ifdocbook
@docbook
<sidebar><title>Interactive Versus Noninteractive Buffering</title>
@end docbook
address@hidden buffering, interactive vs.@: noninteractive
address@hidden buffering @subentry interactive vs.@: noninteractive
As a side point, buffering issues can be even more confusing if
your program is @dfn{interactive} (i.e., communicating
@@ -19319,7 +19319,7 @@ it is all buffered and sent down the pipe to
@command{cat} in one shot.
@center @b{Interactive Versus Noninteractive Buffering}
address@hidden buffering, interactive vs.@: noninteractive
address@hidden buffering @subentry interactive vs.@: noninteractive
As a side point, buffering issues can be even more confusing if
your program is @dfn{interactive} (i.e., communicating
@@ -19395,8 +19395,8 @@ close("/bin/sh")
@end example
@noindent
address@hidden troubleshooting, @code{system()} function
address@hidden @option{--sandbox} option, disabling @code{system()} function
address@hidden troubleshooting @subentry @code{system()} function
address@hidden @option{--sandbox} option @subentry disabling @code{system()}
function
However, if your @command{awk}
program is interactive, @code{system()} is useful for running large
self-contained programs, such as a shell or an editor.
@@ -19441,15 +19441,15 @@ The return values are summarized in
@ref{table-system-return-values}.
As of August, 2018, BWK @command{awk} now follows @command{gawk}'s behavior
for the return value of @code{system()}.
address@hidden sidebar, Controlling Output Buffering with @code{system()}
address@hidden sidebar @subentry Controlling Output Buffering with
@code{system()}
@ifdocbook
@docbook
<sidebar><title>Controlling Output Buffering with @code{system()}</title>
@end docbook
address@hidden buffers, flushing
address@hidden buffering, input/output
address@hidden output, buffering
address@hidden buffers @subentry flushing
address@hidden buffering @subentry input/output
address@hidden output @subentry buffering
The @code{fflush()} function provides explicit control over output buffering
for
individual files and pipes. However, its use is not portable to many older
@@ -19512,9 +19512,9 @@ you would see the latter (undesirable) output.
@center @b{Controlling Output Buffering with @code{system()}}
address@hidden buffers, flushing
address@hidden buffering, input/output
address@hidden output, buffering
address@hidden buffers @subentry flushing
address@hidden buffering @subentry input/output
address@hidden output @subentry buffering
The @code{fflush()} function provides explicit control over output buffering
for
individual files and pipes. However, its use is not portable to many older
@@ -19575,9 +19575,9 @@ you would see the latter (undesirable) output.
@cindex timestamps
@cindex log files, timestamps in
address@hidden files, address@hidden timestamps in
address@hidden @command{gawk}, timestamps
address@hidden POSIX @command{awk}, timestamps and
address@hidden files @subentry log, timestamps in
address@hidden @command{gawk} @subentry timestamps
address@hidden POSIX @command{awk} @subentry timestamps and
@command{awk} programs are commonly used to process log files
containing timestamp information, indicating when a
particular log record was written. Many programs log their timestamps
@@ -19609,7 +19609,7 @@ including negative timestamps that represent times
before the
epoch.
@cindex @command{date} utility, GNU
address@hidden time, retrieving
address@hidden time @subentry retrieving
In order to make it easier to process such log files and to produce
useful reports, @command{gawk} provides the following functions for
working with timestamps. They are @command{gawk} extensions; they are
@@ -19652,7 +19652,7 @@ whether daylight savings time is in effect for the
specified time.
If @var{datespec} does not contain enough elements or if the resulting time
is out of range, @code{mktime()} returns @minus{}1.
address@hidden @command{gawk}, @code{PROCINFO} array in
address@hidden @command{gawk} @subentry @code{PROCINFO} array in
@cindex @code{PROCINFO} array
@item @code{strftime(address@hidden address@hidden,} @var{timestamp}
address@hidden,} @var{utc-flag}] ] address@hidden)}
@cindexgawkfunc{strftime}
@@ -19690,9 +19690,9 @@ log file with the current time of day. In particular,
it is easy to
determine how long ago a particular record was logged. It also allows
you to produce log records using the ``seconds since the epoch'' format.
address@hidden converting, dates to timestamps
address@hidden dates, converting to timestamps
address@hidden timestamps, converting dates to
address@hidden converting @subentry dates to timestamps
address@hidden dates @subentry converting to timestamps
address@hidden timestamps @subentry converting dates to
The @code{mktime()} function allows you to convert a textual representation
of a date and time into a timestamp. This makes it easy to do before/after
comparisons of dates and times, particularly when dealing with date and
@@ -19706,7 +19706,7 @@ in that it copies nonformat specification characters
verbatim to the
returned string, while substituting date and time values for format
specifications in the @var{format} string.
address@hidden format specifiers, @code{strftime()} function (@command{gawk})
address@hidden format specifiers @subentry @code{strftime()} function
(@command{gawk})
@code{strftime()} is guaranteed by the 1999 ISO C
address@hidden,
not every system's @code{strftime()} necessarily
@@ -19908,7 +19908,7 @@ Additionally, the alternative representations are
recognized but their
normal representations are used.
@cindex @code{date} utility, POSIX
address@hidden POSIX @command{awk}, @code{date} utility and
address@hidden POSIX @command{awk} @subentry @code{date} utility and
The following example is an @command{awk} implementation of the POSIX
@command{date} utility. Normally, the @command{date} utility prints the
current date and time of day in a well-known format. However, if you
@@ -19957,7 +19957,7 @@ gawk 'BEGIN @{
@node Bitwise Functions
@subsection Bit-Manipulation Functions
@cindex bit-manipulation functions
address@hidden bitwise, operations
address@hidden bitwise @subentry operations
@cindex AND bitwise operation
@cindex OR bitwise operation
@cindex XOR bitwise operation
@@ -20095,7 +20095,7 @@ The next operation is the @dfn{complement}; the
complement of 1 is 0 and
the complement of 0 is 1. Thus, this operation ``flips'' all the bits
of a given value.
address@hidden bitwise, shift
address@hidden bitwise @subentry shift
@cindex left shift, bitwise
@cindex right shift, bitwise
@cindex shift, bitwise
@@ -20110,7 +20110,7 @@ bits, you end up with @samp{11001000}. The following
list describes
@command{gawk}'s built-in functions that implement the bitwise operations.
Optional parameters are enclosed in square brackets ([ ]):
address@hidden @command{gawk}, bitwise operations in
address@hidden @command{gawk} @subentry bitwise operations in
@table @asis
@cindexgawkfunc{and}
@cindex bitwise AND
@@ -20227,11 +20227,11 @@ $ @kbd{gawk -f testbits.awk}
@print{} rshift(0x99, 2) = 0x26 = 00100110
@end example
address@hidden converting, strings to numbers
address@hidden strings, converting
address@hidden numbers, converting
address@hidden converting, numbers to strings
address@hidden numbers, as string of bits
address@hidden converting @subentry strings to numbers
address@hidden strings @subentry converting
address@hidden numbers @subentry converting
address@hidden converting @subentry numbers to strings
address@hidden numbers @subentry as string of bits
The @code{bits2str()} function turns a binary number into a string.
Initializing @code{mask} to one creates
a binary value where the rightmost bit
@@ -20254,7 +20254,7 @@ decimal and octal values for the same numbers
and then demonstrates the
results of the @code{compl()}, @code{lshift()}, and @code{rshift()} functions.
address@hidden sidebar, Beware The Smoke and Mirrors!
address@hidden sidebar @subentry Beware The Smoke and Mirrors!
@ifdocbook
@docbook
<sidebar><title>Beware The Smoke and Mirrors!</title>
@@ -20474,11 +20474,11 @@ typed regexp.
@node I18N Functions
@subsection String-Translation Functions
address@hidden @command{gawk}, string-translation functions
address@hidden functions, string-translation
address@hidden @command{gawk} @subentry string-translation functions
address@hidden functions @subentry string-translation
@cindex string-translation functions
@cindex internationalization
address@hidden @command{awk} programs, internationalizing
address@hidden @command{awk} programs @subentry internationalizing
@command{gawk} provides facilities for internationalizing @command{awk}
programs.
These include the functions described in the following list.
@@ -20525,7 +20525,7 @@ The default value for @var{category} is
@code{"LC_MESSAGES"}.
@section User-Defined Functions
@cindex user-defined functions
address@hidden functions, user-defined
address@hidden functions @subentry user-defined
Complicated @command{awk} programs can often be simplified by defining
your own functions. User-defined functions can be called just like
built-in ones (@pxref{Function Calls}), but it is up to you to define
@@ -20549,7 +20549,7 @@ variable definitions is appallingly awful.}
@author Brian Kernighan
@end quotation
address@hidden functions, defining
address@hidden functions @subentry defining
Definitions of functions can appear anywhere between the rules of an
@command{awk} program. Thus, the general form of an @command{awk} program is
extended to include sequences of rules @emph{and} user-defined function
@@ -20569,8 +20569,8 @@ The definition of a function named @var{name} looks
like this:
@end group
@end display
address@hidden names, functions
address@hidden functions, names of
address@hidden names @subentry functions
address@hidden functions @subentry names of
@cindex namespace issues, functions
@noindent
Here, @var{name} is the name of the function to define. A valid function
@@ -20626,13 +20626,13 @@ arguments on some occasions and local variables on
others. Another
way to think of this is that omitted arguments default to the
null string.
address@hidden programming conventions, functions, writing
address@hidden programming conventions @subentry functions @subentry writing
Usually when you write a function, you know how many names you intend to
use for arguments and how many you intend to use as local variables. It is
conventional to place some extra space between the arguments and
the local variables, in order to document how your function is supposed to be
used.
address@hidden variables, shadowing
address@hidden variables @subentry shadowing
@cindex shadowing of variable values
During execution of the function body, the arguments and local variable
values hide, or @dfn{shadow}, any variables of the same names used in the
@@ -20647,7 +20647,7 @@ is executing. Once the body finishes, you can once
again access the
variables that were shadowed while the function was running.
@cindex recursive functions
address@hidden functions, recursive
address@hidden functions @subentry recursive
The function body can contain expressions that call functions. They
can even call this function, either directly or by way of another
function. When this happens, we say the function is @dfn{recursive}.
@@ -20659,11 +20659,11 @@ which is described in detail in @ref{Return
Statement}.
Many of the subsequent examples in this @value{SECTION} use
the @code{return} statement.
address@hidden common extensions, @code{func} keyword
address@hidden extensions, address@hidden @code{func} keyword
address@hidden common extensions @subentry @code{func} keyword
address@hidden extensions @subentry common, @code{func} keyword
@c @cindex @command{awk} language, POSIX version
@c @cindex POSIX @command{awk}
address@hidden POSIX @command{awk}, @code{function} keyword in
address@hidden POSIX @command{awk} @subentry @code{function} keyword in
In many @command{awk} implementations, including @command{gawk},
the keyword @code{function} may be
abbreviated @code{func}. @value{COMMONEXT}
@@ -20686,7 +20686,7 @@ syntactically valid, because functions may be used
before they are defined
in @command{awk} address@hidden program won't actually run,
because @code{foo()} is undefined.})
address@hidden portability, address@hidden defining
address@hidden portability @subentry functions, defining
To ensure that your @command{awk} programs are portable, always use the
keyword @code{function} when defining a function.
@@ -20812,7 +20812,7 @@ code could have changed @code{PROCINFO["strftime"]}.
@node Function Calling
@subsection Calling User-Defined Functions
address@hidden functions, user-defined, calling
address@hidden functions @subentry user-defined @subentry calling
@dfn{Calling a function} means causing the function to run and do its job.
A function call is an expression and its value is the value returned by
the function.
@@ -20851,7 +20851,7 @@ an error.
@subsubsection Controlling Variable Scope
@cindex local variables, in a function
address@hidden variables, local to a function
address@hidden variables @subentry local to a function
Unlike in many languages,
there is no way to make a variable local to a @address@hidden @dots{}
@address@hidden block in
@command{awk}, but you can make a variable local to a function. It is
@@ -21036,8 +21036,8 @@ cannot alter this outer value, because it is shadowed
during the
execution of @code{myfunc()} and cannot be seen or changed from there.
@cindex call by reference
address@hidden arrays, as parameters to functions
address@hidden functions, arrays as parameters to
address@hidden arrays @subentry as parameters to functions
address@hidden functions @subentry arrays as parameters to
However, when arrays are the parameters to functions, they are @emph{not}
copied. Instead, the array itself is made available for direct manipulation
by the function. This is usually termed @dfn{call by reference}.
@@ -21072,7 +21072,7 @@ prints @samp{a[1] = 1, a[2] = two, a[3] = 3}, because
@subsubsection Other Points About Calling Functions
@cindex undefined functions
address@hidden functions, undefined
address@hidden functions @subentry undefined
Some @command{awk} implementations allow you to call a function that
has not been defined. They only report a problem at runtime, when the
program actually tries to call the function. For example:
@@ -21093,12 +21093,12 @@ Because the @samp{if} statement will never be true,
it is not really a
problem that @code{foo()} has not been defined. Usually, though, it is a
problem if a program calls an undefined function.
address@hidden lint checking, undefined functions
address@hidden lint checking @subentry undefined functions
If @option{--lint} is specified
(@pxref{Options}),
@command{gawk} reports calls to undefined functions.
address@hidden portability, @code{next} statement in user-defined functions
address@hidden portability @subentry @code{next} statement in user-defined
functions
Some @command{awk} implementations generate a runtime
error if you use either the @code{next} statement
or the @code{nextfile} statement
@@ -21189,7 +21189,7 @@ function maxelt(vec, i, ret)
@}
@end example
address@hidden programming conventions, function parameters
address@hidden programming conventions @subentry function parameters
@noindent
You call @code{maxelt()} with one argument, which is an array name. The local
variables @code{i} and @code{ret} are not intended to be arguments;
@@ -21275,10 +21275,10 @@ being aware of them.
@section Indirect Function Calls
@cindex indirect function calls
address@hidden function calls, indirect
address@hidden function calls @subentry indirect
@cindex function pointers
@cindex pointers to functions
address@hidden differences in @command{awk} and @command{gawk}, indirect
function calls
address@hidden differences in @command{awk} and @command{gawk} @subentry
indirect function calls
This section describes an advanced, @command{gawk}-specific extension.
@@ -21332,7 +21332,7 @@ variable as the @emph{name} of the function to call.
@cindex @code{@@}-notation for indirect function calls
@cindex indirect function calls, @code{@@}-notation
address@hidden function calls, indirect, @code{@@}-notation for
address@hidden function calls @subentry indirect @subentry @code{@@}-notation
for
The syntax is similar to that of a regular function call: an identifier
immediately followed by an opening parenthesis, any arguments, and then
a closing parenthesis, with the addition of a leading @samp{@@}
@@ -21745,8 +21745,8 @@ It contains the following chapters:
@node Library Functions
@chapter A Library of @command{awk} Functions
@cindex libraries of @command{awk} functions
address@hidden functions, library
address@hidden functions, user-defined, library of
address@hidden functions @subentry library
address@hidden functions @subentry user-defined @subentry library of
@ref{User-defined} describes how to write
your own @command{awk} functions. Writing functions is important, because
@@ -21793,7 +21793,7 @@ and would like to contribute them to the @command{awk}
user community, see
@ref{How To Contribute}, for more information.
@end ifclear
address@hidden portability, example programs
address@hidden portability @subentry example programs
The programs in this @value{CHAPTER} and in
@ref{Sample Programs},
freely use @command{gawk}-specific features.
@@ -21813,8 +21813,8 @@ to skip any remaining input in the input file.
@item
@c 12/2000: Thanks to Nelson Beebe for pointing out the output issue.
address@hidden case sensitivity, example programs
address@hidden @code{IGNORECASE} variable, in example programs
address@hidden case sensitivity @subentry example programs
address@hidden @code{IGNORECASE} variable @subentry in example programs
Finally, some of the programs choose to ignore upper- and lowercase
distinctions in their input. They do so by assigning one to @code{IGNORECASE}.
You can achieve almost the same address@hidden effects are
@@ -21851,19 +21851,19 @@ comparisons use only lowercase letters.
@node Library Names
@section Naming Library Function Global Variables
address@hidden names, arrays/variables
address@hidden names, functions
address@hidden names @subentry arrays/variables
address@hidden names @subentry functions
@cindex namespace issues
address@hidden @command{awk} programs, documenting
address@hidden documentation, of @command{awk} programs
address@hidden @command{awk} programs @subentry documenting
address@hidden documentation @subentry of @command{awk} programs
Due to the way the @command{awk} language evolved, variables are either
@dfn{global} (usable by the entire program) or @dfn{local} (usable just by
a specific function). There is no intermediate state analogous to
@code{static} variables in C.
address@hidden variables, global, for library functions
address@hidden variables @subentry global @subentry for library functions
@cindex private variables
address@hidden variables, private
address@hidden variables @subentry private
Library functions often need to have global variables that they can use to
preserve state information between calls to the function---for example,
@code{getopt()}'s variable @code{_opti}
@@ -21877,15 +21877,15 @@ either another library function or a user's main
program. For example, a
name like @code{i} or @code{j} is not a good choice, because user programs
often use variable names like these for their own purposes.
address@hidden programming conventions, private variable names
address@hidden programming conventions @subentry private variable names
The example programs shown in this @value{CHAPTER} all start the names of their
private variables with an underscore (@samp{_}). Users generally don't use
leading underscores in their variable names, so this convention immediately
decreases the chances that the variable names will be accidentally shared
with the user's program.
address@hidden @code{_} (underscore), in names of private variables
address@hidden underscore (@code{_}), in names of private variables
address@hidden @code{_} (underscore) @subentry in names of private variables
address@hidden underscore (@code{_}) @subentry in names of private variables
In addition, several of the library functions use a prefix that helps
indicate what function or set of functions use the variables---for example,
@code{_pw_byname()} in the user database routines
@@ -21925,9 +21925,9 @@ function lib_func(x, y, l1, l2)
@}
@end example
address@hidden arrays, associative, library functions and
address@hidden libraries of @command{awk} functions, associative arrays and
address@hidden functions, library, associative arrays and
address@hidden arrays @subentry associative @subentry library functions and
address@hidden libraries of @command{awk} functions @subentry associative
arrays and
address@hidden functions @subentry library @subentry associative arrays and
@cindex Tcl
A different convention, common in the Tcl community, is to use a single
associative array to hold the values needed by the library function(s), or
@@ -22075,9 +22075,9 @@ be tested with @command{gawk} and the results compared
to the built-in
@cindex assertions
@cindex @code{assert()} function (C library)
address@hidden libraries of @command{awk} functions, assertions
address@hidden functions, library, assertions
address@hidden @command{awk} programs, lengthy, assertions
address@hidden libraries of @command{awk} functions @subentry assertions
address@hidden functions @subentry library @subentry assertions
address@hidden @command{awk} programs @subentry lengthy @subentry assertions
When writing large programs, it is often useful to know
that a condition or set of conditions is true. Before proceeding with a
particular computation, you make a statement about what you believe to be
@@ -22179,7 +22179,7 @@ If the assertion fails, you see a message similar to
the following:
mydata:1357: assertion failed: a <= 5 && b >= 17.1
@end example
address@hidden @code{END} pattern, @code{assert()} user-defined function and
address@hidden @code{END} pattern @subentry @code{assert()} user-defined
function and
There is a small problem with this version of @code{assert()}.
An @code{END} rule is automatically added
to the program calling @code{assert()}. Normally, if a program consists
@@ -22189,7 +22189,7 @@ attempts to read the input @value{DF}s or standard input
(@pxref{Using BEGIN/END}),
most likely causing the program to hang as it waits for input.
address@hidden @code{BEGIN} pattern, @code{assert()} user-defined function and
address@hidden @code{BEGIN} pattern @subentry @code{assert()} user-defined
function and
There is a simple workaround to this:
make sure that such a @code{BEGIN} rule always ends
with an @code{exit} statement.
@@ -22198,11 +22198,11 @@ with an @code{exit} statement.
@subsection Rounding Numbers
@cindex rounding numbers
address@hidden numbers, rounding
address@hidden libraries of @command{awk} functions, rounding numbers
address@hidden functions, library, rounding numbers
address@hidden @code{print} statement, @code{sprintf()} function and
address@hidden @code{printf} statement, @code{sprintf()} function and
address@hidden numbers @subentry rounding
address@hidden libraries of @command{awk} functions @subentry rounding numbers
address@hidden functions @subentry library @subentry rounding numbers
address@hidden @code{print} statement @subentry @code{sprintf()} function and
address@hidden @code{printf} statement @subentry @code{sprintf()} function and
@cindex @code{sprintf()} function, @code{print}/@code{printf} statements and
The way @code{printf} and @code{sprintf()}
(@pxref{Printf})
@@ -22264,10 +22264,10 @@ function round(x, ival, aval, fraction)
@node Cliff Random Function
@subsection The Cliff Random Number Generator
address@hidden random numbers, Cliff
address@hidden random numbers @subentry Cliff
@cindex Cliff random numbers
address@hidden numbers, Cliff random
address@hidden functions, library, Cliff random numbers
address@hidden numbers @subentry Cliff random
address@hidden functions @subentry library @subentry Cliff random numbers
The
@uref{http://mathworld.wolfram.com/CliffRandomNumberGenerator.html, Cliff
random number generator}
@@ -22310,10 +22310,10 @@ isn't random enough, you might try using this
function instead.
@node Ordinal Functions
@subsection Translating Between Characters and Numbers
address@hidden libraries of @command{awk} functions, character values as numbers
address@hidden functions, library, character values as numbers
address@hidden characters, values of as numbers
address@hidden numbers, as values of characters
address@hidden libraries of @command{awk} functions @subentry character values
as numbers
address@hidden functions @subentry library @subentry character values as numbers
address@hidden characters @subentry values of as numbers
address@hidden numbers @subentry as values of characters
One commercial implementation of @command{awk} supplies a built-in function,
@code{ord()}, which takes a character and returns the numeric value for that
character in the machine's character set. If the string passed to
@@ -22435,10 +22435,10 @@ function. It is commented out for production use.
@node Join Function
@subsection Merging an Array into a String
address@hidden libraries of @command{awk} functions, merging arrays into strings
address@hidden functions, library, merging arrays into strings
address@hidden strings, merging arrays into
address@hidden arrays, merging into strings
address@hidden libraries of @command{awk} functions @subentry merging arrays
into strings
address@hidden functions @subentry library @subentry merging arrays into strings
address@hidden strings @subentry merging arrays into
address@hidden arrays @subentry merging into strings
When doing string processing, it is often useful to be able to join
all the strings in an array into one long string. The following function,
@code{join()}, accomplishes this task. It is used later in several of
@@ -22495,10 +22495,10 @@ more difficult than they really need to be.}
@node Getlocaltime Function
@subsection Managing the Time of Day
address@hidden libraries of @command{awk} functions, managing, time
address@hidden functions, library, managing time
address@hidden timestamps, formatted
address@hidden time, managing
address@hidden libraries of @command{awk} functions @subentry managing
@subentry time
address@hidden functions @subentry library @subentry managing time
address@hidden timestamps @subentry formatted
address@hidden time @subentry managing
The @code{systime()} and @code{strftime()} functions described in
@ref{Time Functions}
provide the minimum functionality necessary for dealing with the time of day
@@ -22751,9 +22751,9 @@ function shell_quote(s, # parameter
@node Data File Management
@section @value{DDF} Management
address@hidden files, managing
address@hidden libraries of @command{awk} functions, managing, data files
address@hidden functions, library, managing data files
address@hidden files @subentry managing
address@hidden libraries of @command{awk} functions @subentry managing
@subentry data files
address@hidden functions @subentry library @subentry managing data files
This @value{SECTION} presents functions that are useful for managing
command-line @value{DF}s.
@@ -22768,8 +22768,8 @@ command-line @value{DF}s.
@node Filetrans Function
@subsection Noting @value{DDF} Boundaries
address@hidden files, managing, data file boundaries
address@hidden files, initialization and cleanup
address@hidden files @subentry managing @subentry data file boundaries
address@hidden files @subentry initialization and cleanup
The @code{BEGIN} and @code{END} rules are each executed exactly once, at
the beginning and end of your @command{awk} program, respectively
(@pxref{BEGIN/END}).
@@ -22870,7 +22870,7 @@ END @{ endfile(_filename_) @}
shows how this library function can be used and
how it simplifies writing the main program.
address@hidden sidebar, So Why Does @command{gawk} Have @code{BEGINFILE} and
@code{ENDFILE}?
address@hidden sidebar @subentry So Why Does @command{gawk} Have
@code{BEGINFILE} and @code{ENDFILE}?
@ifdocbook
@docbook
<sidebar><title>So Why Does @command{gawk} Have @code{BEGINFILE} and
@code{ENDFILE}?</title>
@@ -22919,7 +22919,7 @@ For more information, refer to @ref{BEGINFILE/ENDFILE}.
@node Rewind Function
@subsection Rereading the Current File
address@hidden files, reading
address@hidden files @subentry reading
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 @code{getline}
@@ -23005,9 +23005,9 @@ $ @kbd{gawk -f rewind.awk -f test.awk data }
@node File Checking
@subsection Checking for Readable @value{DDF}s
address@hidden troubleshooting, readable data files
address@hidden troubleshooting @subentry readable data files
@cindex readable data address@hidden checking
address@hidden files, skipping
address@hidden files @subentry skipping
Normally, if you give @command{awk} a @value{DF} that isn't readable,
it stops with a fatal error. There are times when you might want to
just ignore such files and keep address@hidden @code{BEGINFILE}
@@ -23045,7 +23045,7 @@ BEGIN @{
@c endfile
@end example
address@hidden troubleshooting, @code{getline} function
address@hidden troubleshooting @subentry @code{getline} function
This works, because the @code{getline} won't be fatal.
Removing the element from @code{ARGV} with @code{delete}
skips the file (because it's no longer in the list).
@@ -23123,7 +23123,7 @@ not @samp{<}.
@subsection Treating Assignments as @value{FFN}s
@cindex assignments as file names
address@hidden file names, assignments as
address@hidden file names @subentry assignments as
Occasionally, you might not want @command{awk} to process command-line
variable assignments
(@pxref{Assignment Options}).
@@ -23182,12 +23182,12 @@ are left alone.
@node Getopt Function
@section Processing Command-Line Options
address@hidden libraries of @command{awk} functions, command-line options
address@hidden functions, library, command-line options
address@hidden command-line options, processing
address@hidden options, command-line, processing
address@hidden functions, library, C library
address@hidden arguments, processing
address@hidden libraries of @command{awk} functions @subentry command-line
options
address@hidden functions @subentry library @subentry command-line options
address@hidden command-line options @subentry processing
address@hidden options @subentry command-line @subentry processing
address@hidden functions @subentry library @subentry C library
address@hidden arguments @subentry processing
Most utilities on POSIX-compatible systems take options on
the command line that can be used to change the way a program behaves.
@command{awk} is an example of such a program
@@ -23541,10 +23541,10 @@ use @code{getopt()} to process their arguments.
@node Passwd Functions
@section Reading the User Database
address@hidden libraries of @command{awk} functions, user database, reading
address@hidden functions, library, user address@hidden reading
address@hidden libraries of @command{awk} functions @subentry user database
@subentry reading
address@hidden functions @subentry library @subentry user database, reading
@cindex user address@hidden reading
address@hidden database, address@hidden reading
address@hidden database @subentry users, reading
@cindex @code{PROCINFO} array
The @code{PROCINFO} array
(@pxref{Built-in Variables})
@@ -23559,11 +23559,11 @@ for a similar suite that retrieves information from
the group database.
@cindex @code{getpwent()} function (C library)
@cindex @code{getpwent()} user-defined function
address@hidden users, information about, retrieving
address@hidden users @subentry information about @subentry retrieving
@cindex login information
@cindex account information
@cindex password file
address@hidden files, password
address@hidden files @subentry password
The POSIX standard does not define the file where user information is
kept. Instead, it provides the @code{<pwd.h>} header file
and several C language subroutines for obtaining user information.
@@ -23764,7 +23764,7 @@ function _pw_init( oldfs, oldrs, olddol0, pwcat,
using_fw, using_fpat)
@c endfile
@end example
address@hidden @code{BEGIN} pattern, @code{pwcat} program
address@hidden @code{BEGIN} pattern @subentry @code{pwcat} program
The @code{BEGIN} rule sets a private variable to the directory where
@command{pwcat} is stored. Because it is used to help out an @command{awk}
library
routine, we have chosen to put it in @file{/usr/local/libexec/awk};
@@ -23777,8 +23777,8 @@ occurrence (@code{_pw_bycount}).
The variable @code{_pw_inited} is used for efficiency, as @code{_pw_init()}
needs to be called only once.
address@hidden @code{PROCINFO} array, testing the field splitting
address@hidden @code{getline} command, @code{_pw_init()} function
address@hidden @code{PROCINFO} array @subentry testing the field splitting
address@hidden @code{getline} command @subentry @code{_pw_init()} function
Because this function uses @code{getline} to read information from
@command{pwcat}, it first saves the values of @code{FS}, @code{RS}, and
@code{$0}.
It notes in the variable @code{using_fw} whether field splitting
@@ -23894,17 +23894,17 @@ uses these functions.
@node Group Functions
@section Reading the Group Database
address@hidden libraries of @command{awk} functions, group database, reading
address@hidden functions, library, group address@hidden reading
address@hidden libraries of @command{awk} functions @subentry group database
@subentry reading
address@hidden functions @subentry library @subentry group database, reading
@cindex group database, reading
address@hidden database, address@hidden reading
address@hidden @code{PROCINFO} array, group membership and
address@hidden database, group, reading
address@hidden @code{PROCINFO} array @subentry group membership and
@cindex @code{getgrent()} function (C library)
@cindex @code{getgrent()} user-defined function
@cindex address@hidden information about
@cindex account information
@cindex group file
address@hidden files, group
address@hidden files @subentry group
Much of the discussion presented in
@ref{Passwd Functions}
applies to the group database as well. Although there has traditionally
@@ -24040,7 +24040,7 @@ $ @kbd{grcat}
Here are the functions for obtaining information from the group database.
There are several, modeled after the C library functions of the same names:
address@hidden @code{getline} command, @code{_gr_init()} user-defined function
address@hidden @code{getline} command @subentry @code{_gr_init()} user-defined
function
@cindex @code{_gr_init()} user-defined function
@example
@c file eg/lib/groupawk.in
@@ -24487,7 +24487,7 @@ output identical to that of the original version.
@node Sample Programs
@chapter Practical @command{awk} Programs
address@hidden @command{awk} programs, examples of
address@hidden @command{awk} programs @subentry examples of
@c FULLXREF ON
@ref{Library Functions},
@@ -24556,7 +24556,7 @@ cut.awk -- -c1-8 myfiles > results
@node Clones
@section Reinventing Wheels for Fun and Profit
address@hidden POSIX, address@hidden implementing in @command{awk}
address@hidden POSIX @subentry programs, implementing in @command{awk}
This @value{SECTION} presents a number of POSIX utilities implemented in
@command{awk}. Reinventing these programs in @command{awk} is often enjoyable,
@@ -24587,8 +24587,8 @@ The programs are presented in alphabetical order.
@cindex @command{cut} utility
@cindex @command{cut} utility
address@hidden fields, cutting
address@hidden columns, cutting
address@hidden fields @subentry cutting
address@hidden columns @subentry cutting
The @command{cut} utility selects, or ``cuts,'' characters or fields
from its standard input and sends them to its standard output.
Fields are separated by TABs by default,
@@ -24668,8 +24668,8 @@ function usage()
@c endfile
@end example
address@hidden @code{BEGIN} pattern, running @command{awk} programs and
address@hidden @code{FS} variable, running @command{awk} programs and
address@hidden @code{BEGIN} pattern @subentry running @command{awk} programs and
address@hidden @code{FS} variable @subentry running @command{awk} programs and
Next comes a @code{BEGIN} rule that parses the command-line options.
It sets @code{FS} to a single TAB character, because that is @command{cut}'s
default field separator. The rule then sets the output field separator to be
the
@@ -24715,7 +24715,7 @@ BEGIN @{
@c endfile
@end example
address@hidden field separators, spaces as
address@hidden field separators @subentry spaces as
The code must take
special care when the field delimiter is a space. Using
a single space (@address@hidden" "}}) for the value of @code{FS} is
@@ -24907,9 +24907,9 @@ of picking the input line apart by characters.
@node Egrep Program
@subsection Searching for Regular Expressions in Files
address@hidden regular expressions, searching for
address@hidden searching, files for regular expressions
address@hidden files, searching for regular expressions
address@hidden regular expressions @subentry searching for
address@hidden searching @subentry files for regular expressions
address@hidden files @subentry searching for regular expressions
@cindex @command{egrep} utility
The @command{egrep} utility searches files for patterns. It uses regular
expressions that are almost identical to those available in @command{awk}
@@ -25122,8 +25122,8 @@ print the @value{FN}, and then skip to the next file
with @code{nextfile}.
Finally, each line is printed, with a leading @value{FN} and colon
if necessary:
address@hidden @code{!} (exclamation point), @code{!} operator
address@hidden exclamation point (@code{!}), @code{!} operator
address@hidden @code{!} (exclamation point) @subentry @code{!} operator
address@hidden exclamation point (@code{!}) @subentry @code{!} operator
@example
@c file eg/prog/egrep.awk
@{
@@ -25183,8 +25183,8 @@ function usage()
@node Id Program
@subsection Printing Out User Information
address@hidden printing, user information
address@hidden users, information about, printing
address@hidden printing @subentry user information
address@hidden users @subentry information about @subentry printing
@cindex @command{id} utility
The @command{id} utility lists a user's real and effective user ID numbers,
real and effective group ID numbers, and the user's group set, if any.
@@ -25197,7 +25197,7 @@ $ @kbd{id}
@print{} uid=1000(arnold) gid=1000(arnold)
groups=1000(arnold),4(adm),7(lp),27(sudo)
@end example
address@hidden @code{PROCINFO} array, user and group ID numbers and
address@hidden @code{PROCINFO} array @subentry user and group ID numbers and
This information is part of what is provided by @command{gawk}'s
@code{PROCINFO} array (@pxref{Built-in Variables}).
However, the @command{id} utility provides a more palatable output than just
@@ -25324,7 +25324,7 @@ the empty string into this function saves several lines
of code.
@c FIXME: One day, update to current POSIX version of split
address@hidden files, splitting
address@hidden files @subentry splitting
@cindex @code{split} utility
The @command{split} program splits large text files into smaller pieces.
Usage is as follows:@footnote{This is the traditional usage. The
@@ -25466,8 +25466,8 @@ way as to solve the EBCDIC issue as well.
@node Tee Program
@subsection Duplicating Output into Multiple Files
address@hidden files, address@hidden duplicating output into
address@hidden output, duplicating into files
address@hidden files @subentry multiple, duplicating output into
address@hidden output @subentry duplicating into files
@cindex @code{tee} utility
The @code{tee} program is known as a ``pipe fitting.'' @code{tee} copies
its standard input to its standard output and also duplicates it to the
@@ -25590,8 +25590,8 @@ END @{
@c FIXME: One day, update to current POSIX version of uniq
address@hidden printing, unduplicated lines of text
address@hidden text, printing, unduplicated lines of
address@hidden printing @subentry unduplicated lines of text
address@hidden text @subentry printing @subentry unduplicated lines of
@cindex @command{uniq} utility
The @command{uniq} utility reads sorted lines of data on its standard
input, and by default removes duplicate lines. In other words, it only
@@ -25872,10 +25872,10 @@ suggestion.
@c FIXME: One day, update to current POSIX version of wc
@cindex counting
address@hidden input files, counting elements in
address@hidden words, counting
address@hidden characters, counting
address@hidden lines, counting
address@hidden input files @subentry counting elements in
address@hidden words @subentry counting
address@hidden characters @subentry counting
address@hidden lines @subentry counting
@cindex @command{wc} utility
The @command{wc} (word count) utility counts lines, words, and characters in
one or more input files. Its usage is as follows:
@@ -26073,8 +26073,8 @@ We hope you find them both interesting and enjoyable.
@node Dupword Program
@subsection Finding Duplicated Words in a Document
address@hidden words, address@hidden searching for
address@hidden searching, for words
address@hidden words @subentry duplicate, searching for
address@hidden searching @subentry for words
@cindex address@hidden searching
A common error when writing large amounts of prose is to accidentally
duplicate words. Typically you will see this in text as something like ``the
@@ -26175,7 +26175,7 @@ Aharon Robbins <address@hidden> wrote:
@author Erik Quanstrom
@end quotation
address@hidden time, alarm clock example program
address@hidden time @subentry alarm clock example program
@cindex alarm clock example program
The following program is a simple ``alarm clock'' program.
You give it a time of day and an optional message. At the specified time,
@@ -26331,7 +26331,7 @@ seconds are necessary:
@node Translate Program
@subsection Transliterating Characters
address@hidden characters, transliterating
address@hidden characters @subentry transliterating
@cindex @command{tr} utility
The system @command{tr} utility transliterates characters. For example, it is
often used to map uppercase letters into lowercase for further processing:
@@ -26483,7 +26483,7 @@ for inspiration.
@node Labels Program
@subsection Printing Mailing Labels
address@hidden printing, mailing labels
address@hidden printing @subentry mailing labels
@cindex mailing address@hidden printing
Here is a ``real-world''@footnote{``Real world'' is defined as
``a program actually used to get something done.''}
@@ -26615,7 +26615,7 @@ END @{
@node Word Sorting
@subsection Generating Word-Usage Counts
address@hidden words, usage address@hidden generating
address@hidden words @subentry usage counts, generating
When working with large amounts of text, it can be interesting to know
how often different words appear. For example, an author may overuse
@@ -26746,7 +26746,7 @@ to use the @command{sort} program.
@node History Sorting
@subsection Removing Duplicates from Unsorted Text
address@hidden lines, address@hidden removing
address@hidden lines @subentry duplicate, removing
The @command{uniq} program
(@pxref{Uniq Program})
removes duplicate lines from @emph{sorted} data.
@@ -26816,8 +26816,8 @@ seen.
@node Extract Program
@subsection Extracting Programs from Texinfo Source Files
address@hidden Texinfo, extracting programs from source files
address@hidden files, address@hidden extracting programs from
address@hidden Texinfo @subentry extracting programs from source files
address@hidden files @subentry Texinfo, extracting programs from
@ifnotinfo
Both this chapter and the previous chapter
(@ref{Library Functions})
@@ -27193,8 +27193,8 @@ value of @code{RT}.
@node Igawk Program
@subsection An Easy Way to Use Library Functions
address@hidden libraries of @command{awk} functions, example program for using
address@hidden functions, library, example program for using
address@hidden libraries of @command{awk} functions @subentry example program
for using
address@hidden functions @subentry library @subentry example program for using
In @ref{Include Files}, we saw how @command{gawk} provides a built-in
file-inclusion capability. However, this is a @command{gawk} extension.
This @value{SECTION} provides the motivation for making file inclusion
@@ -28026,10 +28026,10 @@ things considerably. What problem does this engender
though?
@c answer, reading from "-" or /dev/stdin
@cindex search paths
address@hidden search paths, for source files
address@hidden search paths @subentry for source files
@cindex source address@hidden search path for
address@hidden files, address@hidden search path for
address@hidden directories, searching
address@hidden files @subentry source, search path for
address@hidden directories @subentry searching
@item
As an additional example of the idea that it is not always necessary to
add new features to a program, consider the idea of having two files in
@@ -28095,8 +28095,8 @@ It contains the following chapters:
@node Advanced Features
@chapter Advanced Features of @command{gawk}
address@hidden @command{gawk}, features, advanced
address@hidden advanced features, @command{gawk}
address@hidden @command{gawk} @subentry features @subentry advanced
address@hidden advanced features @subentry @command{gawk}
@ignore
Contributed by: Peter Langston <address@hidden>
@@ -28164,9 +28164,9 @@ discusses the ability to dynamically add new built-in
functions to
@node Nondecimal Data
@section Allowing Nondecimal Input Data
@cindex @option{--non-decimal-data} option
address@hidden advanced features, nondecimal input data
address@hidden input, address@hidden nondecimal
address@hidden constants, nondecimal
address@hidden advanced features @subentry nondecimal input data
address@hidden input @subentry data, nondecimal
address@hidden constants @subentry nondecimal
If you run @command{gawk} with the @option{--non-decimal-data} option,
you can have nondecimal values in your input data:
@@ -28204,7 +28204,7 @@ Because it is common to have decimal data with leading
zeros, and because
using this facility could lead to surprising results, the default is to leave
it
disabled. If you want it, you must explicitly request it.
address@hidden programming conventions, @code{--non-decimal-data} option
address@hidden programming conventions @subentry @code{--non-decimal-data}
option
@cindex @option{--non-decimal-data} option, @code{strtonum()} function and
@cindex @code{strtonum()} function (@command{gawk}), @code{--non-decimal-data}
option and
@quotation CAUTION
@@ -28513,7 +28513,7 @@ sorted array traversal is not the default.
@node Array Sorting Functions
@subsection Sorting Array Values and Indices with @command{gawk}
address@hidden arrays, sorting
address@hidden arrays @subentry sorting
@cindexgawkfunc{asort}
@cindex @code{asort()} function (@command{gawk}), address@hidden sorting
@cindexgawkfunc{asorti}
@@ -28541,7 +28541,7 @@ The default comparison is based on the type of the
elements
All numeric values come before all string values,
which in turn come before all subarrays.
address@hidden side effects, @code{asort()} function
address@hidden side effects @subentry @code{asort()} function
An important side effect of calling @code{asort()} is that
@emph{the array's original indices are irrevocably lost}.
As this isn't always desirable, @code{asort()} accepts a
@@ -28610,9 +28610,9 @@ both arrays use the values.
@end quotation
@c Document It And Call It A Feature. Sigh.
address@hidden @command{gawk}, @code{IGNORECASE} variable in
address@hidden arrays, sorting, @code{IGNORECASE} variable and
address@hidden @code{IGNORECASE} variable, array sorting functions and
address@hidden @command{gawk} @subentry @code{IGNORECASE} variable in
address@hidden arrays @subentry sorting @subentry @code{IGNORECASE} variable and
address@hidden @code{IGNORECASE} variable @subentry array sorting functions and
Because @code{IGNORECASE} affects string comparisons, the value
of @code{IGNORECASE} also affects sorting for both @code{asort()} and
@code{asorti()}.
Note also that the locale's sorting order does @emph{not}
@@ -28711,7 +28711,7 @@ Mike Brennan
@end smallexample
@end ignore
address@hidden advanced features, address@hidden communicating with
address@hidden advanced features @subentry processes, communicating with
@cindex processes, two-way communications with
It is often useful to be able to
send data to a separate program for
@@ -28742,10 +28742,10 @@ Brennan suggests the use of @command{rand()} to
generate unique
remain more difficult to use than two-way pipes.} @c 8/2014
@cindex coprocesses
address@hidden input/output, two-way
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}), @code{|&} operator (I/O)
address@hidden @command{csh} utility, @code{|&} operator, comparison with
address@hidden input/output @subentry two-way
address@hidden @code{|} (vertical bar) @subentry @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}) @subentry @code{|&} operator (I/O)
address@hidden @command{csh} utility @subentry @code{|&} operator @subentry
comparison with
However, with @command{gawk}, it is possible to
open a @emph{two-way} pipe to another process. The second process is
termed a @dfn{coprocess}, as it runs in parallel with @command{gawk}.
@@ -28781,8 +28781,8 @@ standard error goes. It is not possible to read the
child's
standard error separately.
@cindex deadlocks
address@hidden buffering, input/output
address@hidden @code{getline} command, deadlock and
address@hidden buffering @subentry input/output
address@hidden @code{getline} command @subentry deadlock and
@item
I/O buffering may be a problem. @command{gawk} automatically
flushes all output down the pipe to the coprocess.
@@ -28793,7 +28793,7 @@ known as @dfn{deadlock}, where each process is waiting
for the
other one to do something.
@end itemize
address@hidden @code{close()} function, two-way pipes and
address@hidden @code{close()} function @subentry two-way pipes and
It is possible to close just one end of the two-way pipe to
a coprocess, by supplying a second argument to the @code{close()}
function of either @code{"to"} or @code{"from"}
@@ -28859,8 +28859,8 @@ or @code{getline}.
@xref{Nonfatal}, for more information.
@end quotation
address@hidden @command{gawk}, @code{PROCINFO} array in
address@hidden @code{PROCINFO} array, communications via ptys and
address@hidden @command{gawk} @subentry @code{PROCINFO} array in
address@hidden @code{PROCINFO} array @subentry communications via ptys and
You may also use pseudo-ttys (ptys) for
two-way communication instead of pipes, if your system supports them.
This is done on a per-command basis, by setting a special element
@@ -28947,15 +28947,15 @@ And now, magically, it works!
@node TCP/IP Networking
@section Using @command{gawk} for Network Programming
address@hidden advanced features, network programming
address@hidden networks, programming
address@hidden advanced features @subentry network programming
address@hidden networks @subentry programming
@cindex TCP/IP
@cindex @code{/inet/@dots{}} special files (@command{gawk})
address@hidden files, @code{/inet/@dots{}} (@command{gawk})
address@hidden files @subentry @code{/inet/@dots{}} (@command{gawk})
@cindex @code{/inet4/@dots{}} special files (@command{gawk})
address@hidden files, @code{/inet4/@dots{}} (@command{gawk})
address@hidden files @subentry @code{/inet4/@dots{}} (@command{gawk})
@cindex @code{/inet6/@dots{}} special files (@command{gawk})
address@hidden files, @code{/inet6/@dots{}} (@command{gawk})
address@hidden files @subentry @code{/inet6/@dots{}} (@command{gawk})
@cindex @code{EMRED}
@ifnotdocbook
@quotation
@@ -29027,7 +29027,7 @@ Again, use @samp{0} if you don't care, or else a
well-known
service name.
@end table
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @command{gawk} @subentry @code{ERRNO} variable in
@cindex @code{ERRNO} variable
@quotation NOTE
Failure in opening a two-way socket will result in a nonfatal error
@@ -29074,10 +29074,10 @@ no way to access services available over Secure
Socket Layer
@node Profiling
@section Profiling Your @command{awk} Programs
address@hidden @command{awk} programs, profiling
address@hidden @command{awk} programs @subentry profiling
@cindex profiling @command{awk} programs
@cindex @code{awkprof.out} file
address@hidden files, @code{awkprof.out}
address@hidden files @subentry @code{awkprof.out}
You may produce execution traces of your @command{awk} programs.
This is done by passing the option @option{--profile} to @command{gawk}.
@@ -29145,8 +29145,8 @@ Here is the @file{awkprof.out} that results from
running the
illustrates that @command{awk} programmers sometimes get up very early
in the morning to work):
address@hidden @code{BEGIN} pattern, profiling and
address@hidden @code{END} pattern, profiling and
address@hidden @code{BEGIN} pattern @subentry profiling and
address@hidden @code{END} pattern @subentry profiling and
@example
# gawk profile, created Mon Sep 29 05:16:21 2014
@@ -29210,7 +29210,7 @@ Multiple @code{BEGIN} and @code{END} rules retain their
separate identities, as do
multiple @code{BEGINFILE} and @code{ENDFILE} rules.
address@hidden patterns, counts, in a profile
address@hidden patterns @subentry counts @subentry in a profile
@item
Pattern--action rules have two counts.
The first count, to the left of the rule, shows how many times
@@ -29230,7 +29230,7 @@ is a count showing how many times the condition was
true.
The count for the @code{else}
indicates how many times the test failed.
address@hidden loops, count for address@hidden in a profile
address@hidden loops, count for header, in a profile
@item
The count for a loop header (such as @code{for}
or @code{while}) shows how many times the loop test was executed.
@@ -29238,8 +29238,8 @@ or @code{while}) shows how many times the loop test was
executed.
statement in a rule to determine how many times the rule was executed.
If the first statement is a loop, the count is misleading.)
address@hidden functions, user-defined, address@hidden in a profile
address@hidden user-defined, functions, address@hidden in a profile
address@hidden functions @subentry user-defined @subentry counts, in a profile
address@hidden user-defined @subentry functions @subentry counts, in a profile
@item
For user-defined functions, the count next to the @code{function}
keyword indicates how many times the function was called.
@@ -29253,8 +29253,8 @@ The layout uses ``K&R'' style with TABs.
Braces are used everywhere, even when
the body of an @code{if}, @code{else}, or loop is only a single statement.
address@hidden @code{()} (parentheses), in a profile
address@hidden parentheses @code{()}, in a profile
address@hidden @code{()} (parentheses) @subentry in a profile
address@hidden parentheses @code{()} @subentry in a profile
@item
Parentheses are used only where needed, as indicated by the structure
of the program and the precedence rules.
@@ -29310,7 +29310,7 @@ which is correct, but possibly unexpected.
@samp{print}, that distinction is retained.)
@cindex profiling @command{awk} programs, dynamically
address@hidden @command{gawk} program, dynamic profiling
address@hidden @command{gawk} program @subentry dynamic profiling
@cindex dynamic profiling
Besides creating profiles when a program has completed,
@command{gawk} can produce a profile while it is running.
@@ -29327,7 +29327,7 @@ $ @kbd{gawk --profile -f myprog &}
@cindex @command{kill} address@hidden dynamic profiling
@cindex @code{USR1} signal, for dynamic profiling
@cindex @code{SIGUSR1} signal, for dynamic profiling
address@hidden signals, @code{USR1}/@code{SIGUSR1}, for profiling
address@hidden signals @subentry @code{USR1}/@code{SIGUSR1} @subentry for
profiling
@noindent
The shell prints a job number and process ID number; in this case, 13992.
Use the @command{kill} command to send the @code{USR1} signal
@@ -29360,16 +29360,16 @@ profile file.
@cindex @code{HUP} signal, for dynamic profiling
@cindex @code{SIGHUP} signal, for dynamic profiling
address@hidden signals, @code{HUP}/@code{SIGHUP}, for profiling
address@hidden signals @subentry @code{HUP}/@code{SIGHUP} @subentry for
profiling
If you use the @code{HUP} signal instead of the @code{USR1} signal,
@command{gawk} produces the profile and the function call trace and then exits.
@cindex @code{INT} signal (MS-Windows)
@cindex @code{SIGINT} signal (MS-Windows)
address@hidden signals, @code{INT}/@code{SIGINT} (MS-Windows)
address@hidden signals @subentry @code{INT}/@code{SIGINT} (MS-Windows)
@cindex @code{QUIT} signal (MS-Windows)
@cindex @code{SIGQUIT} signal (MS-Windows)
address@hidden signals, @code{QUIT}/@code{SIGQUIT} (MS-Windows)
address@hidden signals @subentry @code{QUIT}/@code{SIGQUIT} (MS-Windows)
When @command{gawk} runs on MS-Windows systems, it uses the
@code{INT} and @code{QUIT} signals for producing the profile, and in
the case of the @code{INT} signal, @command{gawk} exits. This is
@@ -29389,8 +29389,8 @@ Once upon a time, the @option{--pretty-print} option
would also run
your program. This is is no longer the case.
@end quotation
address@hidden profiling, address@hidden difference with
address@hidden pretty-printing, address@hidden difference with
address@hidden profiling, pretty-printing, difference with
address@hidden pretty-printing, profiling, difference with
There is a significant difference between the output created when
profiling, and that created when pretty-printing. Pretty-printed output
preserves the original comments that were in the program, although their
@@ -29474,9 +29474,9 @@ countries, they were able to sell more systems.
As a result, internationalization and localization
of programs and software systems became a common practice.
address@hidden internationalization, localization
address@hidden @command{gawk}, internationalization and, See
internationalization
address@hidden internationalization, localization, @command{gawk} and
address@hidden internationalization @subentry localization
address@hidden @command{gawk}, internationalization and
@seeentry{internationalization}
address@hidden internationalization @subentry localization @subentry
@command{gawk} and
For many years, the ability to provide internationalization
was largely restricted to programs written in C and C++.
This @value{CHAPTER} describes the underlying library @command{gawk}
@@ -29502,7 +29502,7 @@ a requirement.
@section Internationalization and Localization
@cindex internationalization
address@hidden localization, See address@hidden localization
address@hidden localization @address@hidden localization}
@cindex localization
@dfn{Internationalization} means writing (or modifying) a program once,
in such a way that it can use multiple languages without requiring
@@ -29528,7 +29528,7 @@ port doesn't support GNU @command{gettext}.
Therefore, these features are not available
if you are using one of those operating systems. Sorry.}
address@hidden portability, @command{gettext} library and
address@hidden portability @subentry @command{gettext} library and
When using GNU @command{gettext}, each application has its own
@dfn{text domain}. This is a unique name, such as @samp{kpilot} or
@samp{gawk},
that identifies the application.
@@ -29556,9 +29556,9 @@ The programmer indicates the application's text domain
by calling the @code{textdomain()} function.
@cindex @code{.pot} files
address@hidden files, @code{.pot}
address@hidden files @subentry @code{.pot}
@cindex portable object template files
address@hidden files, portable object template
address@hidden files @subentry portable object template
@item
Messages from the application are extracted from the source code and
collected into a portable object template file (@file{guide.pot}),
@@ -29568,9 +29568,9 @@ The original (usually English) messages serve as the
key for
lookup of the translations.
@cindex @code{.po} files
address@hidden files, @code{.po}
address@hidden files @subentry @code{.po}
@cindex portable object files
address@hidden files, portable object
address@hidden files @subentry portable object
@item
For each language with a translator, @file{guide.pot}
is copied to a portable object file (@code{.po})
@@ -29578,9 +29578,9 @@ and translations are created and shipped with the
application.
For example, there might be a @file{fr.po} for a French translation.
@cindex @code{.gmo} files
address@hidden files, @code{.gmo}
address@hidden files @subentry @code{.gmo}
@cindex message object files
address@hidden files, message object
address@hidden files @subentry message object
@item
Each language's @file{.po} file is converted into a binary
message object (@file{.gmo}) file.
@@ -29598,10 +29598,10 @@ For testing and development, it is possible to tell
@command{gettext}
to use @file{.gmo} files in a different directory than the standard
one by using the @code{bindtextdomain()} function.
address@hidden @code{.gmo} files, specifying directory of
address@hidden files, @code{.gmo}, specifying directory of
address@hidden message object files, specifying directory of
address@hidden files, message object, specifying directory of
address@hidden @code{.gmo} files @subentry specifying directory of
address@hidden files @subentry @code{.gmo} @subentry specifying directory of
address@hidden message object files @subentry specifying directory of
address@hidden files @subentry message object @subentry specifying directory of
@item
At runtime, @command{guide} looks up each string via a call
to @code{gettext()}. The returned string is the translated string
@@ -29625,8 +29625,8 @@ printf("%s", gettext("Don't Panic!\n"));
The tools that extract messages from source code pull out all
strings enclosed in calls to @code{gettext()}.
address@hidden @code{_} (underscore), C macro
address@hidden underscore (@code{_}), C macro
address@hidden @code{_} (underscore) @subentry C macro
address@hidden underscore (@code{_}) @subentry C macro
The GNU @command{gettext} developers, recognizing that typing
@samp{gettext(@dots{})} over and over again is both painful and ugly to look
at, use the macro @samp{_} (an underscore) to make things easier:
@@ -29639,7 +29639,7 @@ at, use the macro @samp{_} (an underscore) to make
things easier:
printf("%s", _("Don't Panic!\n"));
@end example
address@hidden internationalization, localization, locale categories
address@hidden internationalization @subentry localization @subentry locale
categories
@cindex @command{gettext} library, locale categories
@cindex locale categories
@noindent
@@ -29682,7 +29682,7 @@ such as @code{/[[:alnum:]]/}
(@pxref{Bracket Expressions}).
@cindex monetary information, localization
address@hidden currency symbols, localization
address@hidden currency symbols @subentry localization
@cindex @code{LC_MONETARY} locale category
@item LC_MONETARY
Monetary information, such as the currency symbol, and whether the
@@ -29696,8 +29696,8 @@ use a comma every three decimal places and a period for
the decimal
point, while many Europeans do exactly the opposite:
1,234.56 versus 1.234,56.}
address@hidden time, localization and
address@hidden dates, information related address@hidden localization
address@hidden time @subentry localization and
address@hidden dates @subentry information related to, localization
@cindex @code{LC_TIME} locale category
@item LC_TIME
Time- and date-related information, such as 12- or 24-hour clock, month printed
@@ -29730,7 +29730,7 @@ for the C @code{bindtextdomain()} function and also see
@node Programmer i18n
@section Internationalizing @command{awk} Programs
address@hidden @command{awk} programs, internationalizing
address@hidden @command{awk} programs @subentry internationalizing
@command{gawk} provides the following variables for
internationalization:
@@ -29742,8 +29742,8 @@ This variable indicates the application's text domain.
For compatibility with GNU @command{gettext}, the default
value is @code{"messages"}.
address@hidden internationalization, localization, marked strings
address@hidden strings, for localization
address@hidden internationalization @subentry localization @subentry marked
strings
address@hidden strings @subentry for localization
@item _"your message here"
String constants marked with a leading underscore
are candidates for translation at runtime.
@@ -29792,10 +29792,10 @@ The default value for @var{category} is
@code{"LC_MESSAGES"}.
The same remarks about argument order as for the @code{dcgettext()} function
apply.
address@hidden @code{.gmo} files, specifying directory of
address@hidden files, @code{.gmo}, specifying directory of
address@hidden message object files, specifying directory of
address@hidden files, message object, specifying directory of
address@hidden @code{.gmo} files @subentry specifying directory of
address@hidden files @subentry @code{.gmo} @subentry specifying directory of
address@hidden message object files @subentry specifying directory of
address@hidden files @subentry message object @subentry specifying directory of
@cindexgawkfunc{bindtextdomain}
@item @code{bindtextdomain(@var{directory}} address@hidden,} @var{domain}
address@hidden)}
Change the directory in which
@@ -29813,8 +29813,8 @@ given @var{domain}.
To use these facilities in your @command{awk} program, follow these steps:
@enumerate
address@hidden @code{BEGIN} pattern, @code{TEXTDOMAIN} variable and
address@hidden @code{TEXTDOMAIN} variable, @code{BEGIN} pattern and
address@hidden @code{BEGIN} pattern @subentry @code{TEXTDOMAIN} variable and
address@hidden @code{TEXTDOMAIN} variable @subentry @code{BEGIN} pattern and
@item
Set the variable @code{TEXTDOMAIN} to the text domain of
your program. This is best done in a @code{BEGIN} rule
@@ -29829,8 +29829,8 @@ BEGIN @{
@}
@end example
address@hidden @code{_} (underscore), translatable string
address@hidden underscore (@code{_}), translatable string
address@hidden @code{_} (underscore) @subentry translatable string
address@hidden underscore (@code{_}) @subentry translatable string
@item
Mark all translatable strings with a leading underscore (@samp{_})
character. It @emph{must} be adjacent to the opening
@@ -29905,9 +29905,9 @@ and use translations from @command{awk}.
@section Translating @command{awk} Programs
@cindex @code{.po} files
address@hidden files, @code{.po}
address@hidden files @subentry @code{.po}
@cindex portable object files
address@hidden files, portable object
address@hidden files @subentry portable object
Once a program's translatable strings have been marked, they must
be extracted to create the initial @file{.pot} file.
As part of translation, it is often helpful to rearrange the order
@@ -29927,9 +29927,9 @@ is covered.
@node String Extraction
@subsection Extracting Marked Strings
address@hidden strings, extracting
address@hidden strings @subentry extracting
@cindex @option{--gen-pot} option
address@hidden command-line options, string extraction
address@hidden command-line options @subentry string extraction
@cindex string extraction (internationalization)
@cindex marked string extraction (internationalization)
@cindex extraction, of marked strings (internationalization)
@@ -29964,8 +29964,8 @@ translations for @command{guide}.
@node Printf Ordering
@subsection Rearranging @code{printf} Arguments
address@hidden @code{printf} statement, positional specifiers
address@hidden positional specifiers, @code{printf} statement
address@hidden @code{printf} statement @subentry positional specifiers
address@hidden positional specifiers @subentry @code{printf} statement
Format strings for @code{printf} and @code{sprintf()}
(@pxref{Printf})
present a special problem for translation.
@@ -30032,9 +30032,9 @@ comes first, then the integer position, and then the
@samp{$}.
This is somewhat counterintuitive.
@end quotation
address@hidden @code{printf} statement, positional specifiers, mixing with
regular formats
address@hidden positional specifiers, @code{printf} statement, mixing with
regular formats
address@hidden format specifiers, mixing regular with positional specifiers
address@hidden @code{printf} statement @subentry positional specifiers
@subentry mixing with regular formats
address@hidden positional specifiers @subentry @code{printf} statement
@subentry mixing with regular formats
address@hidden format specifiers @subentry mixing regular with positional
specifiers
@command{gawk} does not allow you to mix regular format specifiers
and those with positional specifiers in the same string:
@@ -30060,8 +30060,8 @@ is first written.
@node I18N Portability
@subsection @command{awk} Portability Issues
address@hidden portability, internationalization and
address@hidden internationalization, localization, portability and
address@hidden portability @subentry internationalization and
address@hidden internationalization @subentry localization @subentry
portability and
@command{gawk}'s internationalization features were purposely chosen to
have as little impact as possible on the portability of @command{awk}
programs that use them to other versions of @command{awk}.
@@ -30082,7 +30082,7 @@ However, it is actually almost portable, requiring very
little
change:
@itemize @value{BULLET}
address@hidden @code{TEXTDOMAIN} variable, portability and
address@hidden @code{TEXTDOMAIN} variable @subentry portability and
@item
Assignments to @code{TEXTDOMAIN} won't have any effect,
because @code{TEXTDOMAIN} is not special in other @command{awk}
implementations.
@@ -30250,14 +30250,14 @@ We next make the directories:
$ @kbd{mkdir en_US.UTF-8 en_US.UTF-8/LC_MESSAGES}
@end example
address@hidden @code{.po} files, converting to @code{.mo}
address@hidden files, @code{.po}, converting to @code{.mo}
address@hidden @code{.po} files @subentry converting to @code{.mo}
address@hidden files @subentry @code{.po} @subentry converting to @code{.mo}
@cindex @code{.mo} files, converting from @code{.po}
address@hidden files, @code{.mo}, converting from @code{.po}
address@hidden portable object files, converting to message object files
address@hidden files, portable object, converting to message object files
address@hidden message object files, converting from portable object files
address@hidden files, message object, converting from portable object files
address@hidden files @subentry @code{.mo} @subentry converting from @code{.po}
address@hidden portable object files @subentry converting to message object
files
address@hidden files @subentry portable object @subentry converting to message
object files
address@hidden message object files @subentry converting from portable object
files
address@hidden files @subentry message object @subentry converting from
portable object files
@cindex @command{msgfmt} utility
The @command{msgfmt} utility converts the human-readable
@file{.po} file into a machine-readable @file{.mo} file.
@@ -30435,7 +30435,7 @@ functional program that you or someone else wrote).
@node Debugging Terms
@subsection Debugging Concepts
address@hidden debugger, concepts
address@hidden debugger @subentry concepts
Before diving in to the details, we need to introduce several
important concepts that apply to just about all debuggers.
The following list defines terms used throughout the rest of
@@ -30511,7 +30511,7 @@ does not work at the level of machine instructions.}
@section Sample @command{gawk} Debugging Session
@cindex sample debugging session
@cindex example debugging session
address@hidden debugging, example session
address@hidden debugging @subentry example session
In order to illustrate the use of @command{gawk} as a debugger, let's look at
a sample
debugging session. We will use the @command{awk} implementation of the
@@ -30526,7 +30526,7 @@ as our example.
@node Debugger Invocation
@subsection How to Start the Debugger
@cindex starting the debugger
address@hidden debugger, how to start
address@hidden debugger @subentry how to start
Starting the debugger is almost exactly like running @command{gawk} normally,
except you have to pass an additional option, @option{--debug}, or the
@@ -30549,7 +30549,7 @@ in the command line to the debugger rather than as part
of the @code{run}
command at the debugger prompt.)
The @option{-1} is an option to @file{uniq.awk}.
address@hidden debugger, prompt
address@hidden debugger @subentry prompt
Instead of immediately running the program on @file{inputfile}, as
@command{gawk} would ordinarily do, the debugger merely loads all
the program source files, compiles them internally, and then gives
@@ -30599,10 +30599,10 @@ a breakpoint in @file{uniq.awk} is at the beginning
of the function
@code{are_equal()}, which compares the current line with the previous one. To
set
the breakpoint, use the @code{b} (breakpoint) command:
address@hidden debugger, setting a breakpoint
address@hidden debugger, @code{breakpoint} command
address@hidden debugger, @code{break} command
address@hidden debugger, @code{b} command
address@hidden debugger @subentry setting a breakpoint
address@hidden debugger @subentry @code{breakpoint} command
address@hidden debugger @subentry @code{break} command
address@hidden debugger @subentry @code{b} command
@example
gawk> @kbd{b are_equal}
@print{} Breakpoint 1 set at file `awklib/eg/prog/uniq.awk', line 63
@@ -30612,8 +30612,8 @@ The debugger tells us the file and line number where
the breakpoint is.
Now type @samp{r} or @samp{run} and the program runs until it hits
the breakpoint for the first time:
address@hidden debugger, running the program
address@hidden debugger, @code{run} command
address@hidden debugger @subentry running the program
address@hidden debugger @subentry @code{run} command
@example
gawk> @kbd{r}
@print{} Starting program:
@@ -30629,9 +30629,9 @@ let's see how we got to where we are. At the prompt,
we type @samp{bt}
(short for ``backtrace''), and the debugger responds with a
listing of the current stack frames:
address@hidden debugger, stack frames, showing
address@hidden debugger, @code{bt} command
address@hidden debugger, @code{backtrace} command
address@hidden debugger @subentry stack frames @subentry showing
address@hidden debugger @subentry @code{bt} command
address@hidden debugger @subentry @code{backtrace} command
@example
gawk> @kbd{bt}
@print{} #0 are_equal(n, m, clast, cline, alast, aline)
@@ -30651,8 +30651,8 @@ of some variables. Let's say we type @samp{p n}
@code{n}, a parameter to @code{are_equal()}. Actually, the debugger
gives us:
address@hidden debugger, @code{print} command
address@hidden debugger, @code{p} command
address@hidden debugger @subentry @code{print} command
address@hidden debugger @subentry @code{p} command
@example
gawk> @kbd{p n}
@print{} n = untyped variable
@@ -30703,8 +30703,8 @@ be inside this function. To investigate further, we
must begin
``stepping through'' the lines of @code{are_equal()}. We start by typing
@samp{n} (for ``next''):
address@hidden debugger, @code{n} command
address@hidden debugger, @code{next} command
address@hidden debugger @subentry @code{n} command
address@hidden debugger @subentry @code{next} command
@example
@group
gawk> @kbd{n}
@@ -30750,7 +30750,7 @@ This information is useful enough (we now know that
none of the words were accidentally left out), but what if we want to see
inside the array?
address@hidden debugger, printing single array elements
address@hidden debugger @subentry printing single array elements
The first choice would be to use subscripts:
@example
@@ -30770,7 +30770,7 @@ This would be kind of slow for a 100-member array,
though, so
@command{gawk} provides a shortcut (reminiscent of another language
not to be mentioned):
address@hidden debugger, printing all array elements
address@hidden debugger @subentry printing all array elements
@example
gawk> @kbd{p @@alast}
@print{} alast["1"] = "awk"
@@ -30850,7 +30850,7 @@ Getting information
Miscellaneous
@end itemize
address@hidden debugger, repeating commands
address@hidden debugger @subentry repeating commands
Each of these are discussed in the following subsections.
In the following descriptions, commands that may be abbreviated
show the abbreviation on a second description line.
@@ -30880,12 +30880,12 @@ will otherwise just run as if it was not under the
debugger. The commands for
controlling breakpoints are:
@table @asis
address@hidden debugger commands, @code{b} (@code{break})
address@hidden debugger commands, @code{break}
address@hidden debugger commands @subentry @code{b} (@code{break})
address@hidden debugger commands @subentry @code{break}
@cindex @code{break} debugger command
@cindex @code{b} debugger command (alias for @code{break})
@cindex set breakpoint
address@hidden breakpoint, setting
address@hidden breakpoint @subentry setting
@item @code{break} address@hidden@code{:address@hidden | @var{function}]
address@hidden"@var{expression}"}]
@itemx @code{b} address@hidden@code{:address@hidden | @var{function}]
address@hidden"@var{expression}"}]
Without any argument, set a breakpoint at the next instruction
@@ -30915,9 +30915,9 @@ evaluates whenever the breakpoint is reached. If the
condition is true,
then the debugger stops execution and prompts for a command. Otherwise,
it continues executing the program.
address@hidden debugger commands, @code{clear}
address@hidden debugger commands @subentry @code{clear}
@cindex @code{clear} debugger command
address@hidden delete breakpoint, at location
address@hidden delete breakpoint @subentry at location
@cindex breakpoint at location, how to delete
@item @code{clear} address@hidden@code{:address@hidden | @var{function}]
Without any argument, delete any breakpoint at the next instruction
@@ -30937,7 +30937,7 @@ Delete breakpoint(s) set at line number @var{n} in
source file @var{filename}.
Delete breakpoint(s) set at entry to function @var{function}.
@end table
address@hidden debugger commands, @code{condition}
address@hidden debugger commands @subentry @code{condition}
@cindex @code{condition} debugger command
@cindex breakpoint condition
@item @code{condition} @var{n} @code{"@var{expression}"}
@@ -30950,27 +30950,27 @@ the debugger continues executing the program. If the
condition expression is
not specified, any existing condition is removed (i.e., the breakpoint or
watchpoint is made unconditional).
address@hidden debugger commands, @code{d} (@code{delete})
address@hidden debugger commands, @code{delete}
address@hidden debugger commands @subentry @code{d} (@code{delete})
address@hidden debugger commands @subentry @code{delete}
@cindex @code{delete} debugger command
@cindex @code{d} debugger command (alias for @code{delete})
address@hidden delete breakpoint, by number
address@hidden breakpoint, delete by number
address@hidden delete breakpoint @subentry by number
address@hidden breakpoint @subentry delete by number
@item @code{delete} address@hidden n2} @dots{}] address@hidden@var{m}]
@itemx @code{d} address@hidden n2} @dots{}] address@hidden@var{m}]
Delete specified breakpoints or a range of breakpoints. Delete
all defined breakpoints if no argument is supplied.
address@hidden debugger commands, @code{disable}
address@hidden debugger commands @subentry @code{disable}
@cindex @code{disable} debugger command
@cindex disable breakpoint
address@hidden breakpoint, how to disable or enable
address@hidden breakpoint @subentry how to disable or enable
@item @code{disable} address@hidden n2} @dots{} | @address@hidden
Disable specified breakpoints or a range of breakpoints. Without
any argument, disable all breakpoints.
address@hidden debugger commands, @code{e} (@code{enable})
address@hidden debugger commands, @code{enable}
address@hidden debugger commands @subentry @code{e} (@code{enable})
address@hidden debugger commands @subentry @code{enable}
@cindex @code{enable} debugger command
@cindex @code{e} debugger command (alias for @code{enable})
@cindex enable breakpoint
@@ -30991,15 +30991,15 @@ Enable the breakpoints temporarily, then disable each
one when
the program stops at it.
@end table
address@hidden debugger commands, @code{ignore}
address@hidden debugger commands @subentry @code{ignore}
@cindex @code{ignore} debugger command
@cindex ignore breakpoint
@item @code{ignore} @var{n} @var{count}
Ignore breakpoint number @var{n} the next @var{count} times it is
hit.
address@hidden debugger commands, @code{t} (@code{tbreak})
address@hidden debugger commands, @code{tbreak}
address@hidden debugger commands @subentry @code{t} (@code{tbreak})
address@hidden debugger commands @subentry @code{tbreak}
@cindex @code{tbreak} debugger command
@cindex @code{t} debugger command (alias for @code{tbreak})
@cindex temporary breakpoint
@@ -31017,11 +31017,11 @@ and observing its behavior. There are more commands
for controlling
execution of the program than we saw in our earlier example:
@table @asis
address@hidden debugger commands, @code{commands}
address@hidden debugger commands @subentry @code{commands}
@cindex @code{commands} debugger command
address@hidden debugger commands, @code{silent}
address@hidden debugger commands @subentry @code{silent}
@cindex @code{silent} debugger command
address@hidden debugger commands, @code{end}
address@hidden debugger commands @subentry @code{end}
@cindex @code{end} debugger command
@cindex breakpoint commands
@cindex commands to execute at breakpoint
@@ -31050,8 +31050,8 @@ gawk> @kbd{commands}
gawk>
@end example
address@hidden debugger commands, @code{c} (@code{continue})
address@hidden debugger commands, @code{continue}
address@hidden debugger commands @subentry @code{c} (@code{continue})
address@hidden debugger commands @subentry @code{continue}
@cindex continue program, in debugger
@cindex @code{continue} debugger command
@item @code{continue} address@hidden
@@ -31060,14 +31060,14 @@ Resume program execution. If continued from a
breakpoint and @var{count} is
specified, ignore the breakpoint at that location the next @var{count} times
before stopping.
address@hidden debugger commands, @code{finish}
address@hidden debugger commands @subentry @code{finish}
@cindex @code{finish} debugger command
@item @code{finish}
Execute until the selected stack frame returns.
Print the returned value.
address@hidden debugger commands, @code{n} (@code{next})
address@hidden debugger commands, @code{next}
address@hidden debugger commands @subentry @code{n} (@code{next})
address@hidden debugger commands @subentry @code{next}
@cindex @code{next} debugger command
@cindex @code{n} debugger command (alias for @code{next})
@cindex single-step execution, in the debugger
@@ -31077,15 +31077,15 @@ Continue execution to the next source line, stepping
over function calls.
The argument @var{count} controls how many times to repeat the action, as
in @code{step}.
address@hidden debugger commands, @code{ni} (@code{nexti})
address@hidden debugger commands, @code{nexti}
address@hidden debugger commands @subentry @code{ni} (@code{nexti})
address@hidden debugger commands @subentry @code{nexti}
@cindex @code{nexti} debugger command
@cindex @code{ni} debugger command (alias for @code{nexti})
@item @code{nexti} address@hidden
@itemx @code{ni} address@hidden
Execute one (or @var{count}) instruction(s), stepping over function calls.
address@hidden debugger commands, @code{return}
address@hidden debugger commands @subentry @code{return}
@cindex @code{return} debugger command
@item @code{return} address@hidden
Cancel execution of a function call. If @var{value} (either a string or a
@@ -31094,8 +31094,8 @@ frame other than the innermost one (the currently
executing function; i.e.,
frame number 0), discard all inner frames in addition to the selected one,
and the caller of that frame becomes the innermost frame.
address@hidden debugger commands, @code{r} (@code{run})
address@hidden debugger commands, @code{run}
address@hidden debugger commands @subentry @code{r} (@code{run})
address@hidden debugger commands @subentry @code{run}
@cindex @code{run} debugger command
@cindex @code{r} debugger command (alias for @code{run})
@item @code{run}
@@ -31104,8 +31104,8 @@ Start/restart execution of the program. When
restarting, the debugger
retains the current breakpoints, watchpoints, command history,
automatic display variables, and debugger options.
address@hidden debugger commands, @code{s} (@code{step})
address@hidden debugger commands, @code{step}
address@hidden debugger commands @subentry @code{s} (@code{step})
address@hidden debugger commands @subentry @code{step}
@cindex @code{step} debugger command
@cindex @code{s} debugger command (alias for @code{step})
@item @code{step} address@hidden
@@ -31115,8 +31115,8 @@ current stack frame, stepping inside any function
called within
the line. If the argument @var{count} is supplied, steps that many times
before
stopping, unless it encounters a breakpoint or watchpoint.
address@hidden debugger commands, @code{si} (@code{stepi})
address@hidden debugger commands, @code{stepi}
address@hidden debugger commands @subentry @code{si} (@code{stepi})
address@hidden debugger commands @subentry @code{stepi}
@cindex @code{stepi} debugger command
@cindex @code{si} debugger command (alias for @code{stepi})
@item @code{stepi} address@hidden
@@ -31125,8 +31125,8 @@ Execute one (or @var{count}) instruction(s), stepping
inside function calls.
(For illustration of what is meant by an ``instruction'' in @command{gawk},
see the output shown under @code{dump} in @ref{Miscellaneous Debugger
Commands}.)
address@hidden debugger commands, @code{u} (@code{until})
address@hidden debugger commands, @code{until}
address@hidden debugger commands @subentry @code{u} (@code{until})
address@hidden debugger commands @subentry @code{until}
@cindex @code{until} debugger command
@cindex @code{u} debugger command (alias for @code{until})
@item @code{until} address@hidden@code{:address@hidden | @var{function}]
@@ -31143,7 +31143,7 @@ stack frame returns.
The commands for viewing and changing variables inside of @command{gawk} are:
@table @asis
address@hidden debugger commands, @code{display}
address@hidden debugger commands @subentry @code{display}
@cindex @code{display} debugger command
@item @code{display} address@hidden | @address@hidden
Add variable @var{var} (or field @address@hidden) to the display list.
@@ -31163,7 +31163,7 @@ no such variable of the given name exists.
Without argument, @code{display} displays the current values of
items on the list.
address@hidden debugger commands, @code{eval}
address@hidden debugger commands @subentry @code{eval}
@cindex @code{eval} debugger command
@cindex evaluate expressions, in debugger
@item @code{eval "@var{awk statements}"}
@@ -31190,8 +31190,8 @@ This form of @code{eval} is similar, but it allows you
to define
@var{awk statements}, instead of using variables or function
parameters defined by the program.
address@hidden debugger commands, @code{p} (@code{print})
address@hidden debugger commands, @code{print}
address@hidden debugger commands @subentry @code{p} (@code{print})
address@hidden debugger commands @subentry @code{print}
@cindex @code{print} debugger command
@cindex @code{p} debugger command (alias for @code{print})
@cindex print variables, in debugger
@@ -31218,7 +31218,7 @@ gawk> @kbd{print @@a}
This prints the indices and the corresponding values for all elements in
the array @code{a}.
address@hidden debugger commands, @code{printf}
address@hidden debugger commands @subentry @code{printf}
@cindex @code{printf} debugger command
@item @code{printf} @var{format} address@hidden,} @var{arg} @dots{}]
Print formatted text. The @var{format} may include escape sequences,
@@ -31226,9 +31226,9 @@ such as @samp{\n}
(@pxref{Escape Sequences}).
No newline is printed unless one is specified.
address@hidden debugger commands, @code{set}
address@hidden debugger commands @subentry @code{set}
@cindex @code{set} debugger command
address@hidden assign values to variables, in debugger
address@hidden assign values to variables @subentry in debugger
@item @code{set} @address@hidden@var{value}
Assign a constant (number or string) value to an @command{awk} variable
or field.
@@ -31237,8 +31237,8 @@ String values must be enclosed between double quotes
(@code{"address@hidden@code{"}).
You can also set special @command{awk} variables, such as @code{FS},
@code{NF}, @code{NR}, and so on.
address@hidden debugger commands, @code{w} (@code{watch})
address@hidden debugger commands, @code{watch}
address@hidden debugger commands @subentry @code{w} (@code{watch})
address@hidden debugger commands @subentry @code{watch}
@cindex @code{watch} debugger command
@cindex @code{w} debugger command (alias for @code{watch})
@cindex set watchpoint
@@ -31256,14 +31256,14 @@ evaluates whenever the watchpoint is reached. If the
condition is true,
then the debugger stops execution and prompts for a command. Otherwise,
@command{gawk} continues executing the program.
address@hidden debugger commands, @code{undisplay}
address@hidden debugger commands @subentry @code{undisplay}
@cindex @code{undisplay} debugger command
@cindex stop automatic display, in debugger
@item @code{undisplay} address@hidden
Remove item number @var{n} (or all items, if no argument) from the
automatic display list.
address@hidden debugger commands, @code{unwatch}
address@hidden debugger commands @subentry @code{unwatch}
@cindex @code{unwatch} debugger command
@cindex delete watchpoint
@item @code{unwatch} address@hidden
@@ -31282,9 +31282,9 @@ and also move around in the stack to see what the state
of things was in the
functions that called the one you are in. The commands for doing this are:
@table @asis
address@hidden debugger commands, @code{bt} (@code{backtrace})
address@hidden debugger commands, @code{backtrace}
address@hidden debugger commands, @code{where} (@code{backtrace})
address@hidden debugger commands @subentry @code{bt} (@code{backtrace})
address@hidden debugger commands @subentry @code{backtrace}
address@hidden debugger commands @subentry @code{where} (@code{backtrace})
@cindex @code{backtrace} debugger command
@cindex @code{bt} debugger command (alias for @code{backtrace})
@cindex @code{where} debugger command (alias for @code{backtrace})
@@ -31300,14 +31300,14 @@ function, the source @value{FN}, and the line number.
The alias @code{where} for @code{backtrace} is provided for longtime
GDB users who may be used to that command.
address@hidden debugger commands, @code{down}
address@hidden debugger commands @subentry @code{down}
@cindex @code{down} debugger command
@item @code{down} address@hidden
Move @var{count} (default 1) frames down the stack toward the innermost frame.
Then select and print the frame.
address@hidden debugger commands, @code{f} (@code{frame})
address@hidden debugger commands, @code{frame}
address@hidden debugger commands @subentry @code{f} (@code{frame})
address@hidden debugger commands @subentry @code{frame}
@cindex @code{frame} debugger command
@cindex @code{f} debugger command (alias for @code{frame})
@item @code{frame} address@hidden
@@ -31318,7 +31318,7 @@ 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.
address@hidden debugger commands, @code{up}
address@hidden debugger commands @subentry @code{up}
@cindex @code{up} debugger command
@item @code{up} address@hidden
Move @var{count} (default 1) frames up the stack toward the outermost frame.
@@ -31336,8 +31336,8 @@ is used with one of a number of arguments that tell it
exactly what
you want to know:
@table @asis
address@hidden debugger commands, @code{i} (@code{info})
address@hidden debugger commands, @code{info}
address@hidden debugger commands @subentry @code{i} (@code{info})
address@hidden debugger commands @subentry @code{info}
@cindex @code{info} debugger command
@cindex @code{i} debugger command (alias for @code{info})
@item @code{info} @var{what}
@@ -31399,12 +31399,12 @@ save the debugger's state, and the ability to run
debugger commands
from a file. The commands are:
@table @asis
address@hidden debugger commands, @code{o} (@code{option})
address@hidden debugger commands, @code{option}
address@hidden debugger commands @subentry @code{o} (@code{option})
address@hidden debugger commands @subentry @code{option}
@cindex @code{option} debugger command
@cindex @code{o} debugger command (alias for @code{option})
@cindex display debugger options
address@hidden debugger, options
address@hidden debugger @subentry options
@item @code{option} address@hidden@address@hidden
@itemx @code{o} address@hidden@address@hidden
Without an argument, display the available debugger options
@@ -31417,12 +31417,12 @@ The available options are:
@c asis for docbook
@table @asis
@item @code{history_size}
address@hidden debugger, history size
address@hidden debugger @subentry history size
Set the maximum number of lines to keep in the history file
@file{./.gawk_history}. The default is 100.
@item @code{listsize}
address@hidden debugger, default list amount
address@hidden debugger @subentry default list amount
Specify the number of lines that @code{list} prints. The default is 15.
@item @code{outfile}
@@ -31432,11 +31432,11 @@ to standard output. An empty string (@code{""})
resets output to
standard output.
@item @code{prompt}
address@hidden debugger, prompt
address@hidden debugger @subentry prompt
Change the debugger prompt. The default is @address@hidden> }}.
@item @code{save_history} address@hidden | @code{off}]
address@hidden debugger, history file
address@hidden debugger @subentry history file
Save command history to file @file{./.gawk_history}.
The default is @code{on}.
@@ -31448,17 +31448,17 @@ Options are read back into the next session upon
startup.
@item @code{trace} address@hidden | @code{off}]
@cindex instruction tracing, in debugger
address@hidden debugger, instruction tracing
address@hidden debugger @subentry instruction tracing
Turn instruction tracing on or off. The default is @code{off}.
@end table
address@hidden debugger, save commands to a file
address@hidden debugger @subentry save commands to a file
@item @code{save} @var{filename}
Save the commands from the current session to the given @value{FN},
so that they can be replayed using the @command{source} command.
@item @code{source} @var{filename}
address@hidden debugger, read commands from a file
address@hidden debugger @subentry read commands from a file
Run command(s) from a file; an error in any command does not
terminate execution of subsequent commands. Comments (lines starting
with @samp{#}) are allowed in a command file.
@@ -31482,7 +31482,7 @@ There are a few more commands that do not fit into the
previous categories, as follows:
@table @asis
address@hidden debugger commands, @code{dump}
address@hidden debugger commands @subentry @code{dump}
@cindex @code{dump} debugger command
@item @code{dump} address@hidden
Dump byte code of the program to standard output or to the file
@@ -31552,8 +31552,8 @@ gawk>
Exit the debugger.
See the entry for @samp{quit}, later in this list.
address@hidden debugger commands, @code{h} (@code{help})
address@hidden debugger commands, @code{help}
address@hidden debugger commands @subentry @code{h} (@code{help})
address@hidden debugger commands @subentry @code{help}
@cindex @code{help} debugger command
@cindex @code{h} debugger command (alias for @code{help})
@item @code{help}
@@ -31562,8 +31562,8 @@ Print a list of all of the @command{gawk} debugger
commands with a short
summary of their usage. @samp{help @var{command}} prints the information
about the command @var{command}.
address@hidden debugger commands, @code{l} (@code{list})
address@hidden debugger commands, @code{list}
address@hidden debugger commands @subentry @code{l} (@code{list})
address@hidden debugger commands @subentry @code{list}
@cindex @code{list} debugger command
@cindex @code{l} debugger command (alias for @code{list})
@item @code{list} address@hidden | @code{+} | @var{n} |
@address@hidden:address@hidden | @address@hidden | @var{function}]
@@ -31596,8 +31596,8 @@ Print lines centered around the beginning of the
function @var{function}. This command may change the current source file.
@end table
address@hidden debugger commands, @code{q} (@code{quit})
address@hidden debugger commands, @code{quit}
address@hidden debugger commands @subentry @code{q} (@code{quit})
address@hidden debugger commands @subentry @code{quit}
@cindex @code{quit} debugger command
@cindex @code{q} debugger command (alias for @code{quit})
@cindex exit the debugger
@@ -31609,7 +31609,7 @@ 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
@samp{q} or @samp{quit}, to make sure you really want to quit.
address@hidden debugger commands, @code{trace}
address@hidden debugger commands @subentry @code{trace}
@cindex @code{trace} debugger command
@item @code{trace} address@hidden | @code{off}]
Turn on or off continuous printing of the instructions that are about to
@@ -31625,9 +31625,9 @@ fairly self-explanatory, and using @code{stepi} and
@code{nexti} while
@node Readline Support
@section Readline Support
@cindex command completion, in debugger
address@hidden debugger, command completion
address@hidden debugger @subentry command completion
@cindex history expansion, in debugger
address@hidden debugger, history expansion
address@hidden debugger @subentry history expansion
If @command{gawk} is compiled with
@uref{http://cnswww.cns.cwru.edu/php/chet/readline/readline.html,
@@ -31666,7 +31666,7 @@ and
@node Limitations
@section Limitations
address@hidden debugger, limitations
address@hidden debugger @subentry limitations
We hope you find the @command{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 that it's worth being aware of are:
@@ -31845,8 +31845,8 @@ please report them (@xref{Bugs}).
@node Global Namespace
@section Standard @command{awk}'s Single Namespace
address@hidden namespace, definition of
address@hidden namespace, standard @command{awk}, global
address@hidden namespace @subentry definition of
address@hidden namespace @subentry standard @command{awk} @subentry global
In standard @command{awk}, there is a single, global, @dfn{namespace}.
This means that @emph{all} function names and global variable names must
be unique. For example, two different @command{awk} source files cannot
@@ -31876,9 +31876,10 @@ simple mechanism to put functions and global variables
into separate namespaces.
@node Qualified Names
@section Qualified Names
address@hidden qualified name, definition of
address@hidden namespaces, qualified names
address@hidden @code{::}, namespace separator
address@hidden qualified name @subentry definition of
address@hidden namespaces @subentry qualified names
address@hidden @code{:} (colon) @subentry @code{::} namespace separator
address@hidden colon (@code{:}) @subentry @code{::} namespace separator
@cindex component name
A @dfn{qualified name} is an identifier that includes a namespace name,
the namespace separator @code{::}, and a @dfn{component} name. For example,
one
@@ -31892,7 +31893,7 @@ Unlike C++, the @code{::} is @emph{not} an operator.
No spaces are
allowed between the namespace name, the @code{::}, and the component name.
@end quotation
address@hidden qualified name, use of
address@hidden qualified name @subentry use of
You must use qualified names from one namespace to access variables
and functions in another. This is especially important when using
variable names to index the special @code{SYMTAB} array (@pxref{Auto-set}),
@@ -31901,8 +31902,8 @@ and when making indirect function calls
(@pxref{Indirect Calls}).
@node Default Namespace
@section The Default Namespace
address@hidden namespace, default
address@hidden namespace, @code{awk}
address@hidden namespace @subentry default
address@hidden namespace @subentry @code{awk}
@cindex @code{awk} namespace
The default namespace, not surprisingly, is @code{awk}.
All of the predefined @command{awk} and @command{gawk} variables
@@ -31920,7 +31921,7 @@ It also keeps your code looking natural.
@node Changing The Namespace
@section Changing The Namespace
address@hidden namespaces, changing
address@hidden namespaces @subentry changing
@cindex @code{@@namespace} directive
In order to set the current namespace, use an @code{@@namespace} directive
at the top level of your program:
@@ -31946,15 +31947,15 @@ no concept of a ``current'' namespace once your
program starts executing.
Be sure you understand this.
@end quotation
address@hidden namespace, implicit
address@hidden namespace @subentry implicit
@cindex implicit namespace
Each source file for @option{-i} and @option{-f} starts out with
an implicit @samp{@@namespace "awk"}. Similarly, each chunk of
command-line code supplied with @option{-e} has such an implicit
initial statement (@pxref{Options}).
address@hidden current namespace, pushing and popping
address@hidden namespace, pushing and popping
address@hidden current namespace @subentry pushing and popping
address@hidden namespace @subentry pushing and popping
Files included with @code{@@include} (@pxref{Include Files}) ``push''
and ``pop'' the current namespace. That is, each @code{@@include} saves
the current namespace and starts over with an implicit @samp{@@namespace
@@ -31964,10 +31965,10 @@ file, the saved namespace is restored and processing
continues where it
left off in the original file.
@cindex @code{@@namespace}, no effect on @address@hidden @address@hidden
@address@hidden and @code{ENDFILE}
address@hidden @code{BEGIN} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{BEGINFILE} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{END} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{ENDFILE} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{BEGIN} pattern @subentry execution order not affected by
@code{@@namespace}
address@hidden @code{BEGINFILE} pattern @subentry execution order not affected
by @code{@@namespace}
address@hidden @code{END} pattern @subentry execution order not affected by
@code{@@namespace}
address@hidden @code{ENDFILE} pattern @subentry execution order not affected by
@code{@@namespace}
The use of @code{@@namespace} has no influence upon the order of execution
of @code{BEGIN}, @code{BEGINFILE}, @code{END}, and @code{ENDFILE} rules.
@@ -32043,8 +32044,8 @@ $ @kbd{gawk -f systime.awk}
@section Internal Name Management
@cindex name management
address@hidden @code{awk} namespace, identifier name storage
address@hidden @code{awk} namespace, use for indirect function calls
address@hidden @code{awk} namespace @subentry identifier name storage
address@hidden @code{awk} namespace @subentry use for indirect function calls
For backwards compatibility, all identifiers in the @code{awk} namespace
are stored internally as unadorned identifiers (that is, without a
leading @samp{awk::}). This is mainly relevant
@@ -32075,7 +32076,7 @@ function compute() @ii{This is really}
report::compute()
@node Namespace Example
@section Namespace Example
address@hidden namespace, example code
address@hidden namespace @subentry example code
The following example is a revised version of the suite of routines
developed in @ref{Passwd Functions}. See there for an explanation
of how the code works.
@@ -32201,8 +32202,8 @@ $ @kbd{gawk -f ns_passwd.awk -f testpasswd.awk}
This @value{SECTION} looks briefly at how the namespace facility interacts
with other important @command{gawk} features.
address@hidden namespaces, interaction with profiler
address@hidden namespaces, interaction with pretty printer
address@hidden namespaces @subentry interaction with profiler
address@hidden namespaces @subentry interaction with pretty printer
@cindex profiler, interaction with namespaces
@cindex pretty printer, interaction with namespaces
The profiler and pretty-printer (@pxref{Profiling}) have been enhanced
@@ -32212,14 +32213,14 @@ namespace together, and has @code{@@namespace}
directives in front
of rules as necessary. This allows component names to be
simple identifiers, instead of using qualified identifiers everywhere.
address@hidden namespaces, interaction with debugger
address@hidden debugger, interaction with namespaces
address@hidden namespaces @subentry interaction with debugger
address@hidden debugger @subentry interaction with namespaces
Interaction with the debugger (@pxref{Debugging}) has not had to change
(at least as of this writing). Some of the internal byte codes changed
in order to accommodate namespaces, and the debugger's @code{dump} command
was adjusted to match.
address@hidden namespaces, interaction with extension API
address@hidden namespaces @subentry interaction with extension API
@cindex extension API interaction with namespaces
The extension API (@pxref{Dynamic Extensions}) has always allowed for
placing functions into a different namespace, although this was not
@@ -32257,7 +32258,7 @@ namespaces smoothly with their operation. This applies
most notably to
the profiler / pretty-printer (@pxref{Profiling}) and to the extension
facility (@pxref{Dynamic Extensions}).
address@hidden namespaces, backwards compatibility
address@hidden namespaces @subentry backwards compatibility
@item
Overall, the namespace facility was designed and implemented such that
backwards compatibility is paramount. Programs that don't use namespaces
@@ -32270,7 +32271,7 @@ version of @command{gawk}.
@cindex arbitrary precision
@cindex multiple precision
@cindex infinite precision
address@hidden floating-point, address@hidden arbitrary-precision
address@hidden floating-point @subentry numbers, arbitrary-precision
This @value{CHAPTER} introduces some basic concepts relating to
how computers do arithmetic and defines some important terms.
@@ -32339,7 +32340,7 @@ The advantage to integer numbers is that they represent
values exactly.
The disadvantage is that their range is limited.
@cindex unsigned integers
address@hidden integers, unsigned
address@hidden integers @subentry unsigned
In computers, integer values come in two flavors: @dfn{signed} and
@dfn{unsigned}. Signed values may be negative or positive, whereas
unsigned values are always greater than or equal
@@ -32349,7 +32350,7 @@ In computer systems, integer arithmetic is exact, but
the possible
range of values is limited. Integer arithmetic is generally faster than
floating-point arithmetic.
address@hidden floating-point, numbers
address@hidden floating-point @subentry numbers
@item Floating-point arithmetic
Floating-point numbers represent what were called in school ``real''
numbers (i.e., those that have a fractional part, such as 3.1415927).
@@ -32361,9 +32362,9 @@ Modern systems support floating-point arithmetic in
hardware, with a
limited range of values. There are software libraries that allow
the use of arbitrary-precision floating-point calculations.
address@hidden floating-point, address@hidden single-precision
address@hidden floating-point, address@hidden double-precision
address@hidden floating-point, address@hidden arbitrary-precision
address@hidden floating-point @subentry numbers, single-precision
address@hidden floating-point @subentry numbers, double-precision
address@hidden floating-point @subentry numbers, arbitrary-precision
@cindex single-precision
@cindex double-precision
@cindex arbitrary precision
@@ -32987,7 +32988,7 @@ cause any accumulating round-off error to cancel itself
out. This is the
default rounding mode for IEEE 754 computing functions and operators.
@c January 2018. Thanks to address@hidden for the example.
address@hidden sidebar, Rounding Modes and Conversion
address@hidden sidebar @subentry Rounding Modes and Conversion
@ifdocbook
@docbook
<sidebar><title>Rounding Modes and Conversion</title>
@@ -33072,7 +33073,7 @@ output when you change the rounding mode to be sure.
@node Arbitrary Precision Integers
@section Arbitrary-Precision Integer Arithmetic with @command{gawk}
address@hidden integers, arbitrary precision
address@hidden integers @subentry arbitrary precision
@cindex arbitrary precision integers
When given the @option{-M} option,
@@ -33305,9 +33306,9 @@ word sizes. See
@node Checking for MPFR
@section How To Check If MPFR Is Available
address@hidden MPFR, checking availability of
address@hidden MPFR @subentry checking availability of
@cindex checking for MPFR
address@hidden MPFR, checking for
address@hidden MPFR @subentry checking for
Occasionally, you might like to be able to check if @command{gawk}
was invoked with the @option{-M} option, enabling arbitrary-precision
arithmetic. You can do so with the following function, contributed
@@ -34164,7 +34165,7 @@ process and reduces the time needed to create the value.
@node Memory Allocation Functions
@subsection Memory Allocation Functions and Convenience Macros
@cindex allocating memory for extensions
address@hidden extensions, allocating memory
address@hidden extensions @subentry allocating memory
@cindex memory, allocating for extensions
The API provides a number of @dfn{memory allocation} functions for
@@ -35586,7 +35587,7 @@ you should release any cached values that you created,
using
@node Array Manipulation
@subsection Array Manipulation
@cindex array manipulation in extensions
address@hidden extensions, array manipulation in
address@hidden extensions @subentry array manipulation in
The primary data address@hidden, the only data structure.} in @command{awk}
is the associative array (@pxref{Arrays}).
@@ -36802,7 +36803,7 @@ static const char *ext_version = "filefuncs extension:
version 1.0";
int plugin_is_GPL_compatible;
@end example
address@hidden programming conventions, @command{gawk} extensions
address@hidden programming conventions @subentry @command{gawk} extensions
By convention, for an @command{awk} function @code{foo()}, the C function
that implements it is called @code{do_foo()}. The function should have
two arguments. The first is an @code{int}, usually called @code{nargs},
@@ -37144,7 +37145,7 @@ And that's it!
@node Using Internal File Ops
@subsection Integrating the Extensions
address@hidden @command{gawk}, address@hidden adding code to
address@hidden @command{gawk} @subentry interpreter, adding code to
Now that the code is written, it must be possible to add it at
runtime to the running @command{gawk} interpreter. First, the
code must be compiled. Assuming that the functions are in
@@ -37931,7 +37932,7 @@ for more information.
@node gawkextlib
@section The @code{gawkextlib} Project
@cindex @code{gawkextlib}
address@hidden extensions, where to find
address@hidden extensions @subentry where to find
@cindex @code{gawkextlib} project
The @uref{https://sourceforge.net/projects/gawkextlib/, @code{gawkextlib}}
@@ -38251,8 +38252,8 @@ online documentation}.
@node V7/SVR3.1
@appendixsec Major Changes Between V7 and SVR3.1
address@hidden @command{awk}, versions of
address@hidden @command{awk}, versions of, changes between V7 and SVR3.1
address@hidden @command{awk} @subentry versions of
address@hidden @command{awk} @subentry versions of @subentry changes between V7
and SVR3.1
The @command{awk} language evolved considerably between the release of
Version 7 Unix (1978) and the new version that was first made generally
available in
@@ -38342,7 +38343,7 @@ Multidimensional arrays
@node SVR4
@appendixsec Changes Between SVR3.1 and SVR4
address@hidden @command{awk}, versions of, changes between SVR3.1 and SVR4
address@hidden @command{awk} @subentry versions of @subentry changes between
SVR3.1 and SVR4
The System V Release 4 (1989) version of Unix @command{awk} added these
features
(some of which originated in @command{gawk}):
@@ -38400,8 +38401,8 @@ Processing of escape sequences inside command-line
variable assignments
@node POSIX
@appendixsec Changes Between SVR4 and POSIX @command{awk}
address@hidden @command{awk}, versions of, changes between SVR4 and POSIX
@command{awk}
address@hidden POSIX @command{awk}, changes in @command{awk} versions
address@hidden @command{awk} @subentry versions of @subentry changes between
SVR4 and POSIX @command{awk}
address@hidden POSIX @command{awk} @subentry changes in @command{awk} versions
The POSIX Command Language and Utilities standard for @command{awk} (1992)
introduced the following changes into the language:
@@ -38456,9 +38457,9 @@ The 2008 POSIX standard can be found online at
@node BTL
@appendixsec Extensions in Brian Kernighan's @command{awk}
address@hidden @command{awk}, versions of, See Also Brian Kernighan's
@command{awk}
address@hidden extensions, Brian Kernighan's @command{awk}
address@hidden Brian Kernighan's @command{awk}, extensions
address@hidden @command{awk} @subentry versions of @seealso{Brian Kernighan's
@command{awk}}
address@hidden extensions @subentry Brian Kernighan's @command{awk}
address@hidden Brian Kernighan's @command{awk} @subentry extensions
@cindex Kernighan, Brian
Brian Kernighan
has made his version available via his home page
@@ -38497,9 +38498,9 @@ available in his @command{awk}.
@node POSIX/GNU
@appendixsec Extensions in @command{gawk} Not in POSIX @command{awk}
address@hidden compatibility mode (@command{gawk}), extensions
address@hidden extensions, in @command{gawk}, not in POSIX @command{awk}
address@hidden POSIX, @command{gawk} extensions not included in
address@hidden compatibility mode (@command{gawk}) @subentry extensions
address@hidden extensions @subentry in @command{gawk} @subentry not in POSIX
@command{awk}
address@hidden POSIX @subentry @command{gawk} extensions not included in
The GNU implementation, @command{gawk}, adds a large number of features.
They can all be disabled with either the @option{--traditional} or
@option{--posix} options
@@ -39591,8 +39592,8 @@ to write code that takes the operating system /
platform into account.
@node Common Extensions
@appendixsec Common Extensions Summary
address@hidden extensions, Brian Kernighan's @command{awk}
address@hidden extensions, @command{mawk}
address@hidden extensions @subentry Brian Kernighan's @command{awk}
address@hidden extensions @subentry @command{mawk}
The following table summarizes the common extensions supported
by @command{gawk}, Brian Kernighan's @command{awk}, and @command{mawk},
the three most widely used freely available versions of @command{awk}
@@ -39722,7 +39723,7 @@ In all cases @command{gawk} remains POSIX-compliant.
@node Contributors
@appendixsec Major Contributors to @command{gawk}
address@hidden @command{gawk}, list of contributors to
address@hidden @command{gawk} @subentry list of contributors to
@quotation
@i{Always give credit where credit is due.}
@author Anonymous
@@ -40036,8 +40037,8 @@ the appropriate credit where credit is due.
@appendix Installing @command{gawk}
@c last two commas are part of see also
address@hidden operating systems, See Also GNU/address@hidden PC operating
address@hidden Unix
address@hidden @command{gawk}, installing
address@hidden operating systems @seealso{GNU/address@hidden PC operating
address@hidden Unix}
address@hidden @command{gawk} @subentry installing
@cindex installing @command{gawk}
This appendix provides instructions for installing @command{gawk} on the
various platforms that are supported by the developers. The primary
@@ -40060,7 +40061,7 @@ the respective ports.
@node Gawk Distribution
@appendixsec The @command{gawk} Distribution
address@hidden source code, @command{gawk}
address@hidden source code @subentry @command{gawk}
This @value{SECTION} describes how to get the @command{gawk}
distribution, how to extract it, and then what is in the various files and
@@ -40074,7 +40075,7 @@ subdirectories.
@node Getting
@appendixsubsec Getting the @command{gawk} Distribution
address@hidden @command{gawk}, source address@hidden obtaining
address@hidden @command{gawk} @subentry source code, obtaining
There are two ways to get GNU software:
@itemize @value{BULLET}
@@ -40150,7 +40151,7 @@ a local expert.
@node Distribution contents
@appendixsubsec Contents of the @command{gawk} Distribution
address@hidden @command{gawk}, distribution
address@hidden @command{gawk} @subentry distribution
The @command{gawk} distribution has a number of C source files,
documentation files,
@@ -40486,7 +40487,7 @@ Add the argument to the end of the @env{AWKLIBPATH}
environment variable.
@node Additional Configuration Options
@appendixsubsec Additional Configuration Options
address@hidden @command{gawk}, configuring, options
address@hidden @command{gawk} @subentry configuring @subentry options
@cindex configuration address@hidden @command{gawk}
There are several additional options you may use on the @command{configure}
@@ -40495,7 +40496,7 @@ command line when compiling @command{gawk} from
scratch, including:
@table @code
@cindex @option{--disable-extensions} configuration option
address@hidden configuration option, @code{--disable-extensions}
address@hidden configuration option @subentry @code{--disable-extensions}
@item --disable-extensions
Disable configuring and building the sample extensions in the
@file{extension} directory. This is useful for cross-compiling.
@@ -40503,7 +40504,7 @@ The default action is to dynamically check if the
extensions
can be configured and compiled.
@cindex @option{--disable-lint} configuration option
address@hidden configuration option, @code{--disable-lint}
address@hidden configuration option @subentry @code{--disable-lint}
@item --disable-lint
Disable all lint checking within @command{gawk}. The
@option{--lint} and @option{--lint-old} options
@@ -40526,21 +40527,21 @@ to fail. This option may be removed at a later date.
@end quotation
@cindex @option{--disable-mpfr} configuration option
address@hidden configuration option, @code{--disable-mpfr}
address@hidden configuration option @subentry @code{--disable-mpfr}
@item --disable-mpfr
Skip checking for the MPFR and GMP libraries. This is useful
mainly for the developers, to make sure nothing breaks if
MPFR support is not available.
@cindex @option{--disable-nls} configuration option
address@hidden configuration option, @code{--disable-nls}
address@hidden configuration option @subentry @code{--disable-nls}
@item --disable-nls
Disable all message-translation facilities.
This is usually not desirable, but it may bring you some slight performance
improvement.
@cindex @option{--enable-versioned-extension-dir} configuration option
address@hidden configuration option, @code{--enable-versioned-extension-dir}
address@hidden configuration option @subentry
@code{--enable-versioned-extension-dir}
@item --enable-versioned-extension-dir
Use a versioned directory for extensions. The directory name will
include the major and minor API versions in it. This makes it possible
@@ -40555,7 +40556,7 @@ options supplied by @command{configure}.
@node Configuration Philosophy
@appendixsubsec The Configuration Process
address@hidden @command{gawk}, configuring
address@hidden @command{gawk} @subentry configuring
This @value{SECTION} is of interest only if you know something about using the
C language and Unix-like operating systems.
@@ -40616,8 +40617,8 @@ various non-Unix systems.
@node PC Installation
@appendixsubsec Installation on MS-Windows
address@hidden PC operating systems, @command{gawk} on, installing
address@hidden operating systems, address@hidden @command{gawk} on, installing
address@hidden PC operating address@hidden @command{gawk} on, installing
address@hidden operating systems @subentry PC, @command{gawk} on @subentry
installing
This @value{SECTION} covers installation and usage of @command{gawk}
on Intel architecture machines running any version of MS-Windows.
In this @value{SECTION}, the term ``Windows32''
@@ -40666,8 +40667,8 @@ type @samp{make mingw32}.
@node PC Using
@appendixsubsubsec Using @command{gawk} on PC Operating Systems
address@hidden operating systems, address@hidden @command{gawk} on
address@hidden PC operating systems, @command{gawk} on
address@hidden operating systems, PC, @command{gawk} on
address@hidden PC operating systems @subentry @command{gawk} on
Information in this section applies to the MinGW and
DJGPP ports of @command{gawk}. @xref{Cygwin} for information
@@ -40679,10 +40680,10 @@ both the @samp{|&} operator and TCP/IP networking
The DJGPP environment does not support @samp{|&}.
@cindex search paths
address@hidden search paths, for source files
address@hidden @command{gawk}, MS-Windows version of
address@hidden @code{;} (semicolon), @env{AWKPATH} variable and
address@hidden semicolon (@code{;}), @env{AWKPATH} variable and
address@hidden search paths @subentry for source files
address@hidden @command{gawk} @subentry MS-Windows version of
address@hidden @code{;} (semicolon) @subentry @env{AWKPATH} variable and
address@hidden semicolon (@code{;}) @subentry @env{AWKPATH} variable and
@cindex @env{AWKPATH} environment variable
The MS-Windows version of @command{gawk} searches for
program files as described in @ref{AWKPATH Variable}. However,
@@ -40690,9 +40691,9 @@ semicolons (rather than colons) separate elements in
the @env{AWKPATH}
variable. If @env{AWKPATH} is not set or is empty, then the default
search path is @address@hidden;c:/lib/awk;c:/gnu/lib/awk}}.
address@hidden common extensions, @code{BINMODE} variable
address@hidden extensions, address@hidden @code{BINMODE} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{BINMODE}
variable
address@hidden common extensions @subentry @code{BINMODE} variable
address@hidden extensions @subentry common, @code{BINMODE} variable
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{BINMODE} variable
@cindex @code{BINMODE} variable
Under MS-Windows,
@command{gawk} (and many other text programs) silently
@@ -40835,7 +40836,7 @@ translation of @code{"\r\n"}, because it won't.
@c now address@hidden
@c now address@hidden
address@hidden @command{gawk}, VMS version of
address@hidden @command{gawk} @subentry VMS version of
@cindex installation, VMS
This @value{SUBSECTION} describes how to compile and install @command{gawk}
under VMS.
The older designation ``VMS'' is used throughout to refer to OpenVMS.
@@ -41050,7 +41051,7 @@ flag is required to force Unix-style parsing rather
than @code{DCL} parsing.
If any other dash-type options (or multiple parameters such as @value{DF}s to
process) are present, there is no ambiguity and @option{--} can be omitted.
address@hidden exit status, of @command{gawk}, on VMS
address@hidden exit status @subentry of @command{gawk} @subentry on VMS
The @code{exit} value is a Unix-style value and is encoded into a VMS exit
status value when the program exits.
@@ -41076,7 +41077,7 @@ Older versions of @command{gawk} for VMS treated a Unix
exit code 0 as 1,
a failure as 2, a fatal error as 4, and passed all the other numbers through.
This violated the VMS exit status coding requirements.
address@hidden floating-point, VAX/VMS
address@hidden floating-point @subentry VAX/VMS
VAX/VMS floating point uses unbiased rounding. @xref{Round Function}.
VMS reports time values in GMT unless one of the @code{SYS$TIMEZONE_RULE}
@@ -41086,7 +41087,7 @@ or @code{TZ} logical names is set. Older versions of
VMS, such as VAX/VMS
@c @cindex directory search
@c @cindex path, search
@cindex search paths
address@hidden search paths, for source files
address@hidden search paths @subentry for source files
The default search path, when looking for @command{awk} program files specified
by the @option{-f} option, is @code{"SYS$DISK:[],AWK_LIBRARY:"}. The logical
name @env{AWKPATH} can be used to override this default. The format
@@ -41214,8 +41215,8 @@ recommend compiling and using the current version.
@end quotation
@c the radio show, not the book. :-)
address@hidden debugging @command{gawk}, bug reports
address@hidden troubleshooting, @command{gawk}, bug reports
address@hidden debugging @command{gawk} @subentry bug reports
address@hidden troubleshooting @subentry @command{gawk} @subentry bug reports
If you have problems with @command{gawk} or think that you have found a bug,
report it to the developers; we cannot promise to do anything,
but we might well want to fix it.
@@ -41374,7 +41375,7 @@ report to the @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu
dot org} email list as we
@node Other Versions
@appendixsec Other Freely Available @command{awk} Implementations
address@hidden @command{awk}, implementations
address@hidden @command{awk} @subentry implementations
@ignore
From: emory!amc.com!brennan (Michael Brennan)
Subject: C++ comments in awk programs
@@ -41403,9 +41404,9 @@ This @value{SECTION} briefly describes where to get
them:
@table @asis
@cindex Kernighan, Brian
address@hidden source code, Brian Kernighan's @command{awk}
address@hidden @command{awk}, versions of, See Also Brian Kernighan's
@command{awk}
address@hidden Brian Kernighan's @command{awk}, source code
address@hidden source code @subentry Brian Kernighan's @command{awk}
address@hidden @command{awk} @subentry versions of @seealso{Brian Kernighan's
@command{awk}}
address@hidden Brian Kernighan's @command{awk} @subentry source code
@item Unix @command{awk}
Brian Kernighan, one of the original designers of Unix @command{awk},
has made his implementation of
@@ -41439,7 +41440,7 @@ available at
@uref{git://github.com/danfuzz/one-true-awk}.
@cindex Brennan, Michael
@cindex @command{mawk} utility
address@hidden source code, @command{mawk}
address@hidden source code @subentry @command{mawk}
@item @command{mawk}
Michael Brennan wrote an independent implementation of @command{awk},
called @command{mawk}. It is available under the
@@ -41476,7 +41477,7 @@ His development snapshots are available via Git from
the project's
@cindex Sumner, Andrew
@cindex @command{awka} compiler for @command{awk}
address@hidden source code, @command{awka}
address@hidden source code @subentry @command{awka}
@item @command{awka}
Written by Andrew Sumner,
@command{awka} translates @command{awk} programs into C, compiles them,
@@ -41496,7 +41497,7 @@ since approximately 2001.
@cindex Beebe, Nelson H.F.@:
@cindex @command{pawk} (profiling version of Brian Kernighan's @command{awk})
address@hidden source code, @command{pawk}
address@hidden source code @subentry @command{pawk}
@item @command{pawk}
Nelson H.F.@: Beebe at the University of Utah has modified
BWK @command{awk} to provide timing and profiling information.
@@ -41510,7 +41511,7 @@ or
@item BusyBox @command{awk}
@cindex BusyBox Awk
address@hidden source code, BusyBox Awk
address@hidden source code @subentry 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 @command{awk}. When building
@@ -41520,7 +41521,7 @@ information, see the @uref{https://busybox.net,
project's home page}.
@cindex OpenSolaris
@cindex Solaris, POSIX-compliant @command{awk}
address@hidden source code, Solaris @command{awk}
address@hidden source code @subentry Solaris @command{awk}
@item The OpenSolaris POSIX @command{awk}
The versions of @command{awk} in @file{/usr/xpg4/bin} and
@file{/usr/xpg6/bin} on Solaris are more or less POSIX-compliant.
@@ -41532,7 +41533,7 @@ has not been done, at least to our knowledge.
@cindex Illumos
@cindex Illumos, POSIX-compliant @command{awk}
address@hidden source code, Illumos @command{awk}
address@hidden source code @subentry Illumos @command{awk}
The source code used to be available from the OpenSolaris website.
However, that project was ended and the website shut down. Fortunately, the
@uref{https://wiki.illumos.org/display/illumos/illumos+Home, Illumos project}
@@ -41541,8 +41542,8 @@ makes this implementation available. You can view the
files one at a time from
@cindex @command{goawk}
@cindex Go implementation of @command{awk}
address@hidden source code, @command{goawk}
address@hidden programming languages, Go
address@hidden source code @subentry @command{goawk}
address@hidden programming languages @subentry Go
@item @command{goawk}
This is an @command{awk} interpreter written in the
@uref{https://golang.org/, Go programming language}.
@@ -41554,7 +41555,7 @@ describing the implementation.
@cindex @command{jawk}
@cindex Java implementation of @command{awk}
address@hidden source code, @command{jawk}
address@hidden source code @subentry @command{jawk}
@item @command{jawk}
This is an interpreter for @command{awk} written in Java. It claims
to be a full interpreter, although because it uses Java facilities
@@ -41564,13 +41565,13 @@ from POSIX @command{awk}. More information is
available on the
@item Libmawk
@cindex libmawk
address@hidden source code, libmawk
address@hidden source code @subentry libmawk
This is an embeddable @command{awk} interpreter derived from
@command{mawk}. For more information, see
@uref{http://repo.hu/projects/libmawk/}.
@item @code{pawk}
address@hidden source code, @command{pawk} (Python version)
address@hidden source code @subentry @command{pawk} (Python version)
@cindex @code{pawk}, @command{awk}-like facilities for Python
This is a Python module that claims to bring @command{awk}-like
features to Python. See @uref{https://github.com/alecthomas/pawk}
@@ -41579,13 +41580,13 @@ modified version of BWK @command{awk}, described
earlier.)
@item @w{QSE @command{awk}}
@cindex QSE @command{awk}
address@hidden source code, QSE @command{awk}
address@hidden source code @subentry QSE @command{awk}
This is an embeddable @command{awk} interpreter. For more information,
see @uref{https://code.google.com/p/qse/}. @c and
@uref{http://awk.info/?tools/qse}.
@item @command{QTawk}
@cindex QuikTrim Awk
address@hidden source code, QuikTrim Awk
address@hidden source code @subentry QuikTrim Awk
This is an independent implementation of @command{awk} distributed
under the GPL. It has a large number of extensions over standard
@command{awk} and may not be 100% syntactically compatible with it.
@@ -41649,8 +41650,8 @@ implementations. Many are POSIX-compliant; others are
less so.
@ifclear FOR_PRINT
@node Notes
@appendix Implementation Notes
address@hidden @command{gawk}, implementation issues
address@hidden implementation issues, @command{gawk}
address@hidden @command{gawk} @subentry implementation issues
address@hidden implementation issues @subentry @command{gawk}
This appendix contains information mainly of interest to implementers and
maintainers of @command{gawk}. Everything in it applies specifically to
@@ -41668,10 +41669,10 @@ maintainers of @command{gawk}. Everything in it
applies specifically to
@node Compatibility Mode
@appendixsec Downward Compatibility and Debugging
address@hidden @command{gawk}, implementation issues, downward compatibility
address@hidden @command{gawk}, implementation issues, debugging
address@hidden troubleshooting, @command{gawk}
address@hidden implementation issues, @command{gawk}, debugging
address@hidden @command{gawk} @subentry implementation issues @subentry
downward compatibility
address@hidden @command{gawk} @subentry implementation issues @subentry
debugging
address@hidden troubleshooting @subentry @command{gawk}
address@hidden implementation address@hidden @command{gawk}, debugging
@xref{POSIX/GNU},
for a summary of the GNU extensions to the @command{awk} language and program.
@@ -41753,9 +41754,9 @@ that has a Git plug-in for working with Git
repositories.
@node Adding Code
@appendixsubsec Adding New Features
address@hidden adding, features to @command{gawk}
address@hidden features, adding to @command{gawk}
address@hidden @command{gawk}, features, adding
address@hidden adding @subentry features to @command{gawk}
address@hidden features @subentry adding to @command{gawk}
address@hidden @command{gawk} @subentry features @subentry adding
You are free to add any new features you like to @command{gawk}.
However, if you want your changes to be incorporated into the @command{gawk}
distribution, there are several steps that you need to take in order to
@@ -41801,7 +41802,7 @@ the GNU Project's
@uref{https://www.gnu.org/prep/standards/, website}.
Texinfo, Info, and DVI versions are also available.)
address@hidden @command{gawk}, coding style in
address@hidden @command{gawk} @subentry coding style in
@item
Use the @command{gawk} coding style.
The C code for @command{gawk} follows the instructions in the
@@ -41927,8 +41928,8 @@ probably will not.
@node New Ports
@appendixsubsec Porting @command{gawk} to a New Operating System
address@hidden portability, @command{gawk}
address@hidden operating systems, porting @command{gawk} to
address@hidden portability @subentry @command{gawk}
address@hidden operating systems @subentry porting @command{gawk} to
@cindex porting @command{gawk}
If you want to port @command{gawk} to a new operating system, there are
@@ -41972,7 +41973,7 @@ A number of the files that come with @command{gawk} are
maintained by other
people. Thus, you should not change them
unless it is for a very good reason; i.e., changes are not out of the
question, but changes to these files are scrutinized extra carefully.
-These aree all the files the @file{support} directory
+These are all the files the @file{support} directory
within the @command{gawk} distribution. See there.
@item
@@ -42585,8 +42586,8 @@ removed from the code base with the 4.2 release.
@node Basic Concepts
@appendix Basic Programming Concepts
address@hidden programming, concepts
address@hidden programming, concepts
address@hidden programming @subentry concepts
address@hidden programming @subentry concepts
This @value{APPENDIX} attempts to define some of the basic concepts
and terms that are used throughout the rest of this @value{DOCUMENT}.
@@ -42642,7 +42643,7 @@ or it may be @dfn{interpreted}. In the latter case, a
machine-executable
program such as @command{awk} reads your program, and then uses the
instructions in your program to process the data.
address@hidden programming, basic steps
address@hidden programming @subentry basic steps
When you write a program, it usually consists
of the following, very basic set of steps,
@ifnotdocbook
@@ -42750,8 +42751,8 @@ and the fields of the record.
You may also group multiple
associated values under one name, as an array.
address@hidden values, numeric
address@hidden values, string
address@hidden values @subentry numeric
address@hidden values @subentry string
@cindex scalar values
Data, particularly in @command{awk}, consists of either numeric
values, such as 42 or 3.1415927, or string values.
@@ -42835,7 +42836,7 @@ rule's action. Actions are always enclosed in braces.
(@xref{Action Overview}.)
@cindex Ada programming language
address@hidden programming languages, Ada
address@hidden programming languages @subentry Ada
@item Ada
A programming language originally defined by the U.S.@: Department of
Defense for embedded programming. It was designed to enforce good
@@ -43430,7 +43431,7 @@ information about the name of the organization and its
language-independent
three-letter acronym.
@cindex Java programming language
address@hidden programming languages, Java
address@hidden programming languages @subentry Java
@item Java
A modern programming language originally developed by Sun Microsystems
(now Oracle) supporting Object-Oriented programming. Although usually
diff --git a/doc/sidebar.awk b/doc/sidebar.awk
index d1f3efc..ca485fa 100644
--- a/doc/sidebar.awk
+++ b/doc/sidebar.awk
@@ -37,7 +37,7 @@ BEGIN {
/address@hidden \t]+sidebar[ \t]*$/ {
collecting = 0
- printf "@cindex sidebar, %s\n", title
+ printf "@cindex sidebar @subentry %s\n", title
printf "@ifdocbook\n"
printf "@docbook\n"
printf "<sidebar><title>%s</title>\n", title
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=cab07e64da25528b986b28ab0d7f0e307da93759
commit cab07e64da25528b986b28ab0d7f0e307da93759
Author: Arnold D. Robbins <address@hidden>
Date: Mon Apr 1 22:41:37 2019 +0300
Lots of indexing improvements.
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 982291d..521c411 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -1330,12 +1330,12 @@ properly written @command{awk} programs should work
with @command{gawk}.
So most of the time, we don't distinguish between @command{gawk} and other
@command{awk} implementations.
address@hidden @command{awk}, POSIX and @seealso{POSIX @command{awk}}
address@hidden @command{awk}, POSIX and
address@hidden POSIX, @command{awk} and
address@hidden @command{gawk}, @command{awk} and
address@hidden @command{awk}, @command{gawk} and
address@hidden @command{awk}, uses for
address@hidden @command{awk} @subentry POSIX and @seealso{POSIX @command{awk}}
address@hidden @command{awk} @subentry POSIX and
address@hidden POSIX @subentry @command{awk} and
address@hidden @command{gawk} @subentry @command{awk} and
address@hidden @command{awk} @subentry @command{gawk} and
address@hidden @command{awk} @subentry uses for
Using @command{awk} you can:
@itemize @value{BULLET}
@@ -1358,7 +1358,7 @@ languages
@cindex @command{awk} @address@hidden
@cindex @command{gawk} @address@hidden
address@hidden @command{gawk}, uses for
address@hidden @command{gawk} @subentry uses for
In addition,
@command{gawk}
provides facilities that make it easy to:
@@ -1437,7 +1437,7 @@ more parts C. Document very well and release.
@cindex Aho, Alfred
@cindex Weinberger, Peter
@cindex Kernighan, Brian
address@hidden @command{awk}, history of
address@hidden @command{awk} @subentry history of
The name @command{awk} comes from the initials of its designers: Alfred V.@:
Aho, Peter J.@: Weinberger, and Brian W.@: Kernighan. The original version of
@command{awk} was written in 1977 at AT&T Bell Laboratories.
@@ -1484,7 +1484,7 @@ for a full list of those who have made important
contributions to @command{gawk}
@node Names
@unnumberedsec A Rose by Any Other Name
address@hidden @command{awk}, new vs.@: old
address@hidden @command{awk} @subentry new vs.@: old
The @command{awk} language has evolved over the years. Full details are
provided in @ref{Language History}.
The language described in this @value{DOCUMENT}
@@ -1519,7 +1519,7 @@ specific to the GNU implementation, we use the term
@command{gawk}.
@node This Manual
@unnumberedsec Using This Book
address@hidden @command{awk}, terms describing
address@hidden @command{awk} @subentry terms describing
The term @command{awk} refers to a particular program as well as to the
language you
use to tell this program what to do. When we need to be careful, we call
@@ -1531,8 +1531,8 @@ run the @command{awk} utility.
The term address@hidden program'' refers to a program written by you in
the @command{awk} programming language.
address@hidden @command{gawk}, @command{awk} and
address@hidden @command{awk}, @command{gawk} and
address@hidden @command{gawk} @subentry @command{awk} and
address@hidden @command{awk} @subentry @command{gawk} and
@cindex POSIX @command{awk}
Primarily, this @value{DOCUMENT} explains the features of @command{awk}
as defined in the POSIX standard. It does so in the context of the
@@ -1936,7 +1936,7 @@ Emacs editor. GNU Emacs is the most widely used version
of Emacs today.
@cindex GNU Project
@cindex GPL (General Public License)
@cindex General Public License @seeentry{GPL}
address@hidden documentation, online
address@hidden documentation @subentry online
The address@hidden stands for ``GNU's Not Unix.''}
Project is an ongoing effort on the part of the Free Software
Foundation to create a complete, freely distributable, POSIX-compliant
@@ -1968,7 +1968,7 @@ stage of development.
@cindex Linux
@cindex GNU/Linux
address@hidden operating systems, BSD-based
address@hidden operating systems @subentry BSD-based
Until the GNU operating system is more fully developed, you should
consider using GNU/Linux, a freely distributable, Unix-like operating
system for Intel,
@@ -2318,7 +2318,7 @@ following chapters:
@c @cindex rule, definition of
@c @cindex program, definition of
@c @cindex basic function of @command{awk}
address@hidden @command{awk}, function of
address@hidden @command{awk} @subentry function of
The basic function of @command{awk} is to search files for lines (or other
units of text) that contain certain patterns. When a line matches one
@@ -2326,7 +2326,7 @@ of the patterns, @command{awk} performs specified actions
on that line.
@command{awk} continues to process input lines in this way until it reaches
the end of the input files.
address@hidden @command{awk}, uses for
address@hidden @command{awk} @subentry uses for
@cindex programming address@hidden data-driven vs.@: procedural
@cindex @command{awk} programs
Programs in @command{awk} are different from programs in most other languages,
@@ -2380,7 +2380,7 @@ program looks like this:
@node Running gawk
@section How to Run @command{awk} Programs
address@hidden @command{awk} programs, running
address@hidden @command{awk} programs @subentry running
There are several ways to run an @command{awk} program. If the program is
short, it is easiest to include it in the command that runs @command{awk},
like this:
@@ -2389,7 +2389,7 @@ like this:
awk '@var{program}' @var{input-file1} @var{input-file2} @dots{}
@end example
address@hidden command line, formats
address@hidden command line @subentry formats
When the program is long, it is usually more convenient to put it in a file
and run it with a command like this:
@@ -2438,8 +2438,8 @@ characters. The quotes also cause the shell to treat all
of @var{program} as
a single argument for @command{awk}, and allow @var{program} to be more
than one line long.
address@hidden shells, scripts
address@hidden @command{awk} programs, running, from shell scripts
address@hidden shells @subentry scripts
address@hidden @command{awk} programs @subentry running @subentry from shell
scripts
This format is also useful for running short or medium-sized @command{awk}
programs from shell scripts, because it avoids the need for a separate
file for the @command{awk} program. A self-contained shell script is more
@@ -2457,8 +2457,8 @@ self-contained programs.
@subsection Running @command{awk} Without Input Files
@cindex standard input
address@hidden input, standard
address@hidden input files, running @command{awk} without
address@hidden input @subentry standard
address@hidden input files @subentry running @command{awk} without
You can also run @command{awk} without any input files. If you type the
following command line:
@@ -2473,8 +2473,8 @@ until you indicate end-of-file by typing @kbd{Ctrl-d}.
(On non-POSIX operating systems, the end-of-file character may be different.)
@cindex files, input @seeentry{input files}
address@hidden input files, running @command{awk} without
address@hidden @command{awk} programs, running, without input files
address@hidden input files @subentry running @command{awk} without
address@hidden @command{awk} programs @subentry running @subentry without input
files
As an example, the following program prints a friendly piece of advice
(from Douglas Adams's @cite{The Hitchhiker's Guide to the Galaxy}),
to keep you from worrying about the complexities of computer
@@ -2520,9 +2520,9 @@ $ @kbd{awk '@{ print @}'}
@node Long
@subsection Running Long Programs
address@hidden @command{awk} programs, running
address@hidden @command{awk} programs, lengthy
address@hidden files, @command{awk} programs in
address@hidden @command{awk} programs @subentry running
address@hidden @command{awk} programs @subentry lengthy
address@hidden files @subentry @command{awk} programs in
Sometimes @command{awk} programs are very long. In these cases, it is
more convenient to put the program into a separate file. In order to tell
@command{awk} to use that file for its program, you type:
@@ -2532,7 +2532,7 @@ awk -f @var{source-file} @var{input-file1}
@var{input-file2} @dots{}
@end example
@cindex @option{-f} option
address@hidden command line, option @option{-f}
address@hidden command line @subentry option @option{-f}
The @option{-f} instructs the @command{awk} utility to get the
@command{awk} program from the file @var{source-file} (@pxref{Options}).
Any @value{FN} can be used for @var{source-file}. For example, you
@@ -2556,7 +2556,7 @@ does the same thing as this one:
awk 'BEGIN @{ print "Don\47t Panic!" @}'
@end example
address@hidden quoting, in @command{gawk} command lines
address@hidden quoting @subentry in @command{gawk} command lines
@noindent
This was explained earlier
(@pxref{Read Terminal}).
@@ -2568,8 +2568,8 @@ for programs that are provided on the @command{awk}
command line.
(Also, placing the program in a file allows us to use a literal single quote
in the program
text, instead of the magic @samp{\47}.)
address@hidden single quote (@code{'}) in @command{gawk} command lines
address@hidden @code{'} (single quote) in @command{gawk} command lines
address@hidden single quote (@code{'}) @subentry in @command{gawk} command lines
address@hidden @code{'} (single quote) @subentry in @command{gawk} command lines
If you want to clearly identify an @command{awk} program file as such,
you can add the extension @file{.awk} to the @value{FN}. This doesn't
affect the execution of the @command{awk} program but it does make
@@ -2578,9 +2578,9 @@ affect the execution of the @command{awk} program but it
does make
@node Executable Scripts
@subsection Executable @command{awk} Programs
@cindex @command{awk} programs
address@hidden @code{#} (number sign), @code{#!} (executable scripts)
address@hidden @code{#} (number sign) @subentry @code{#!} (executable scripts)
@cindex Unix, @command{awk} scripts and
address@hidden number sign (@code{#}), @code{#!} (executable scripts)
address@hidden number sign (@code{#}) @subentry @code{#!} (executable scripts)
Once you have learned @command{awk}, you may want to write self-contained
@command{awk} scripts, using the @samp{#!} script mechanism. You can do
@@ -2616,7 +2616,7 @@ program that users can invoke without their having to
know that the program is
written in @command{awk}.
@sidebar Understanding @samp{#!}
address@hidden portability, @code{#!} (executable scripts)
address@hidden portability @subentry @code{#!} (executable scripts)
@command{awk} is an @dfn{interpreted} language. This means that the
@command{awk} utility reads your program and then processes your data
@@ -2645,9 +2645,9 @@ treats the rest of the line as a single argument and
passes it to @command{awk}.
Doing this leads to confusing behavior---most likely a usage diagnostic
of some sort from @command{awk}.
address@hidden @code{ARGC}/@code{ARGV} variables, portability and
address@hidden portability, @code{ARGV} variable
address@hidden dark corner, @code{ARGV} variable, value of
address@hidden @code{ARGC}/@code{ARGV} variables @subentry portability and
address@hidden portability @subentry @code{ARGV} variable
address@hidden dark corner @subentry @code{ARGV} variable @subentry value of
Finally, the value of @code{ARGV[0]}
(@pxref{Built-in Variables})
varies depending upon your operating system.
@@ -2660,10 +2660,10 @@ to provide your script name.
@node Comments
@subsection Comments in @command{awk} Programs
address@hidden @code{#} (number sign), commenting
address@hidden number sign (@code{#}), commenting
address@hidden @code{#} (number sign) @subentry commenting
address@hidden number sign (@code{#}) @subentry commenting
@cindex commenting
address@hidden @command{awk} programs, documenting
address@hidden @command{awk} programs @subentry documenting
A @dfn{comment} is some text that is included in a program for the sake
of human readers; it is not really an executable part of the program. Comments
@@ -2688,9 +2688,9 @@ programs, but this usually isn't very useful; the purpose
of a
comment is to help you or another person understand the program
when reading it at a later time.
address@hidden quoting, for small awk programs
address@hidden single quote (@code{'}), vs.@: apostrophe
address@hidden @code{'} (single quote), vs.@: apostrophe
address@hidden quoting @subentry for small awk programs
address@hidden single quote (@code{'}) @subentry vs.@: apostrophe
address@hidden @code{'} (single quote) @subentry vs.@: apostrophe
@quotation CAUTION
As mentioned in
@ref{One-shot},
@@ -2746,7 +2746,7 @@ the shell prompt, or writing it as part of a larger shell
script:
awk '@var{program text}' @var{input-file1} @var{input-file2} @dots{}
@end example
address@hidden shells, quoting, rules for
address@hidden shells @subentry quoting @subentry rules for
@cindex Bourne shell, quoting rules for
Once you are working with the shell, it is helpful to have a basic
knowledge of shell quoting rules. The following rules apply only to
@@ -2785,10 +2785,10 @@ that character. The shell removes the backslash and
passes the quoted
character on to the command.
@item
address@hidden @code{\} (backslash), in shell commands
address@hidden backslash (@code{\}), in shell commands
address@hidden single quote (@code{'}), in shell commands
address@hidden @code{'} (single quote), in shell commands
address@hidden @code{\} (backslash) @subentry in shell commands
address@hidden backslash (@code{\}) @subentry in shell commands
address@hidden single quote (@code{'}) @subentry in shell commands
address@hidden @code{'} (single quote) @subentry in shell commands
Single quotes protect everything between the opening and closing quotes.
The shell does no interpretation of the quoted text, passing it on verbatim
to the command.
@@ -2798,8 +2798,8 @@ Refer back to
for an example of what happens if you try.
@item
address@hidden double quote (@code{"}), in shell commands
address@hidden @code{"} (double quote), in shell commands
address@hidden double quote (@code{"}) @subentry in shell commands
address@hidden @code{"} (double quote) @subentry in shell commands
Double quotes protect most things between the opening and closing quotes.
The shell does at least variable and command substitution on the quoted text.
Different shells may do additional kinds of processing on double-quoted text.
@@ -2827,8 +2827,8 @@ $ @kbd{awk "BEGIN @{ print \"Don't Panic!\" @}"}
@print{} Don't Panic!
@end example
address@hidden single quote (@code{'}), with double quotes
address@hidden @code{'} (single quote), with double quotes
address@hidden single quote (@code{'}) @subentry with double quotes
address@hidden @code{'} (single quote) @subentry with double quotes
Note that the single quote is not special within double quotes.
@item
@@ -2842,7 +2842,7 @@ awk -F "" '@var{program}' @var{files} # correct
@end example
@noindent
address@hidden null strings in @command{gawk} arguments, quoting and
address@hidden null strings in @command{gawk} arguments @subentry quoting and
Don't use this:
@example
@@ -2855,7 +2855,7 @@ as the value of @code{FS}, and the first @value{FN} as
the text of the program!
This results in syntax errors at best, and confusing behavior at worst.
@end itemize
address@hidden quoting, in @command{gawk} command lines, tricks for
address@hidden quoting @subentry in @command{gawk} command lines @subentry
tricks for
Mixing single and double quotes is difficult. You have to resort
to shell quoting tricks, like this:
@@ -3017,7 +3017,7 @@ double-quote don't need duplication.
@node Sample Data Files
@section @value{DDF}s for the Examples
address@hidden input files, examples
address@hidden input files @subentry examples
@cindex @code{mail-list} file
Many of the examples in this @value{DOCUMENT} take their input from two sample
@value{DF}s. The first, @file{mail-list}, represents a list of peoples' names
@@ -3130,21 +3130,21 @@ $ @kbd{awk '/li/ @{ print $0 @}' mail-list}
@print{} Samuel 555-3430 samuel.lanceolis@@shu.edu A
@end example
address@hidden actions, default
address@hidden patterns, default
address@hidden actions @subentry default
address@hidden patterns @subentry default
In an @command{awk} rule, either the pattern or the action can be omitted,
but not both. If the pattern is omitted, then the action is performed
for @emph{every} input line. If the action is omitted, the default
action is to print all lines that match the pattern.
address@hidden actions, empty
address@hidden actions @subentry empty
Thus, we could leave out the action (the @code{print} statement and the
braces) in the previous example and the result would be the same:
@command{awk} prints all lines matching the pattern @samp{li}. By comparison,
omitting the @code{print} statement but retaining the braces makes an
empty action that does nothing (i.e., no lines are printed).
address@hidden @command{awk} programs, one-line examples
address@hidden @command{awk} programs @subentry one-line examples
Many practical @command{awk} programs are just a line or two long. Following
is a
collection of useful, short programs to get you started. Some of these
programs contain constructs that haven't been covered yet. (The description
@@ -3349,7 +3349,7 @@ the file was last modified. Its output looks like this:
@end example
@noindent
address@hidden line continuations, with C shell
address@hidden line continuations @subentry with C shell
The first field contains read-write permissions, the second field contains
the number of links to the file, and the third field identifies the file's
owner.
The fourth field identifies the file's group.
@@ -3395,7 +3395,7 @@ awk '/12/ @{ print $0 @}
/21/ @{ print $0 @}' mail-list inventory-shipped
@end example
address@hidden @command{gawk}, newlines in
address@hidden @command{gawk} @subentry newlines in
However, @command{gawk} ignores newlines after any of the following
symbols and keywords:
@@ -3412,8 +3412,8 @@ Splitting lines after @samp{?} and @samp{:} is a minor
@command{gawk}
extension; if @option{--posix} is specified
(@pxref{Options}), then this extension is disabled.}
address@hidden @code{\} (backslash), continuing lines and
address@hidden backslash (@code{\}), continuing lines and
address@hidden @code{\} (backslash) @subentry continuing lines and
address@hidden backslash (@code{\}) @subentry continuing lines and
If you would like to split a single statement into two lines at a point
where a newline would terminate it, you can @dfn{continue} it by ending the
first line with a backslash character (@samp{\}). The backslash must be
@@ -3427,7 +3427,7 @@ awk '/This regular expression is too long, so continue it\
@end example
@noindent
address@hidden portability, backslash continuation and
address@hidden portability @subentry backslash continuation and
We have generally not used backslash continuation in our sample programs.
@command{gawk} places no limit on the
length of a line, so backslash continuation is never strictly necessary;
@@ -3445,8 +3445,8 @@ lines in the middle of a regular expression or a string.
@c solaris 2.7 nawk does not. Solaris /usr/xpg4/bin/awk does though! sigh.
@cindex @command{csh} utility
address@hidden backslash (@code{\}), continuing lines and, in @command{csh}
address@hidden @code{\} (backslash), continuing lines and, in @command{csh}
address@hidden backslash (@code{\}) @subentry continuing lines and @subentry in
@command{csh}
address@hidden @code{\} (backslash) @subentry continuing lines and @subentry in
@command{csh}
@quotation CAUTION
@emph{Backslash continuation does not work as described
with the C shell.} It works for @command{awk} programs in files and
@@ -3484,8 +3484,8 @@ begin on the same line as the pattern. To have the
pattern and action
on separate lines, you @emph{must} use backslash continuation; there
is no other option.
address@hidden backslash (@code{\}), continuing lines and, comments and
address@hidden @code{\} (backslash), continuing lines and, comments and
address@hidden backslash (@code{\}) @subentry continuing lines and @subentry
comments and
address@hidden @code{\} (backslash) @subentry continuing lines and @subentry
comments and
@cindex commenting, backslash continuation and
Another thing to keep in mind is that backslash continuation and
comments do not mix. As soon as @command{awk} sees the @samp{#} that
@@ -3508,11 +3508,11 @@ next line. However, the backslash-newline combination
is never even
noticed because it is ``hidden'' inside the comment. Thus, the
@code{BEGIN} is noted as a syntax error.
address@hidden statements, multiple
address@hidden @code{;} (semicolon), separating statements in actions
address@hidden semicolon (@code{;}), separating statements in actions
address@hidden @code{;} (semicolon), separating rules
address@hidden semicolon (@code{;}), separating rules
address@hidden statements @subentry multiple
address@hidden @code{;} (semicolon) @subentry separating statements in actions
address@hidden semicolon (@code{;}) @subentry separating statements in actions
address@hidden @code{;} (semicolon) @subentry separating rules
address@hidden semicolon (@code{;}) @subentry separating rules
When @command{awk} statements within one rule are short, you might want to put
more than one of them on a line. This is accomplished by separating the
statements
with a semicolon (@samp{;}).
@@ -3555,7 +3555,7 @@ systematically in @ref{Built-in Variables} and in
@node When
@section When to Use @command{awk}
address@hidden @command{awk}, uses for
address@hidden @command{awk} @subentry uses for
Now that you've seen some of what @command{awk} can do,
you might wonder how @command{awk} could be useful for you. By using
utility programs, advanced patterns, field separators, arithmetic
@@ -3586,7 +3586,7 @@ computer.
The original @command{awk}'s capabilities were strained by tasks
of such complexity, but modern versions are more capable.
address@hidden @command{awk} programs, complex
address@hidden @command{awk} programs @subentry complex
If you find yourself writing @command{awk} scripts of more than, say,
a few hundred lines, you might consider using a different programming
language. The shell is good at string and pattern matching; in addition,
@@ -3666,10 +3666,10 @@ things in this @value{CHAPTER} that don't interest you
right now.
@node Command Line
@section Invoking @command{awk}
address@hidden command line, invoking @command{awk} from
address@hidden @command{awk}, invoking
address@hidden arguments, command-line, invoking @command{awk}
address@hidden options, command-line, invoking @command{awk}
address@hidden command line @subentry invoking @command{awk} from
address@hidden @command{awk} @subentry invoking
address@hidden arguments @subentry command-line @subentry invoking @command{awk}
address@hidden options @subentry command-line @subentry invoking @command{awk}
There are two ways to run @command{awk}---with an explicit program or with
one or more program files. Here are templates for both of them; items
@@ -3682,12 +3682,12 @@ enclosed in address@hidden in these templates are
optional:
@cindex GNU long options
@cindex long options
address@hidden options, long
address@hidden options @subentry long
In addition to traditional one-letter POSIX-style options, @command{gawk} also
supports GNU long options.
address@hidden dark corner, invoking @command{awk}
address@hidden lint checking, empty programs
address@hidden dark corner @subentry invoking @command{awk}
address@hidden lint checking @subentry empty programs
It is possible to invoke @command{awk} with an empty program:
@example
@@ -3695,7 +3695,7 @@ awk '' datafile1 datafile2
@end example
@cindex @option{--lint} option
address@hidden dark corner, empty programs
address@hidden dark corner @subentry empty programs
@noindent
Doing so makes little sense, though; @command{awk} exits
silently when given an empty program.
@@ -3706,10 +3706,10 @@ warning that the program is empty.
@node Options
@section Command-Line Options
address@hidden options, command-line
address@hidden command line, options
address@hidden options @subentry command-line
address@hidden command line @subentry options
@cindex GNU long options
address@hidden options, long
address@hidden options @subentry long
Options begin with a dash and consist of a single character.
GNU-style long options consist of two dashes and a keyword.
@@ -3721,7 +3721,7 @@ by whitespace.
If a particular option with a value is given more than once, it is the
last value that counts.
address@hidden POSIX @command{awk}, GNU long options and
address@hidden POSIX @command{awk} @subentry GNU long options and
Each long option for @command{gawk} has a corresponding
POSIX-style short option.
The long and short options are
@@ -3733,7 +3733,7 @@ The following list describes options mandated by the
POSIX standard:
@itemx --field-separator @var{fs}
@cindex @option{-F} option
@cindex @option{--field-separator} option
address@hidden @code{FS} variable, @code{--field-separator} option and
address@hidden @code{FS} variable @subentry @code{--field-separator} option and
Set the @code{FS} variable to @var{fs}
(@pxref{Field Separators}).
@@ -3741,7 +3741,7 @@ Set the @code{FS} variable to @var{fs}
@itemx --file @var{source-file}
@cindex @option{-f} option
@cindex @option{--file} option
address@hidden @command{awk} programs, location of
address@hidden @command{awk} programs @subentry location of
Read the @command{awk} program source from @var{source-file}
instead of in the first nonoption argument.
This option may be given multiple times; the @command{awk}
@@ -3755,7 +3755,7 @@ at their beginning. @xref{Changing The Namespace}, for
more information.
@itemx --assign @address@hidden
@cindex @option{-v} option
@cindex @option{--assign} option
address@hidden variables, setting
address@hidden variables @subentry setting
Set the variable @var{var} to the value @var{val} @emph{before}
execution of the program begins. Such variable values are available
inside the @code{BEGIN} rule
@@ -3765,8 +3765,8 @@ The @option{-v} option can only set one variable, but it
can be used
more than once, setting another variable each time, like this:
@samp{awk @w{-v foo=1} @w{-v bar=2} @dots{}}.
address@hidden predefined variables, @code{-v} address@hidden setting with
address@hidden variables, predefined, @code{-v} address@hidden setting with
address@hidden predefined variables @subentry @code{-v} option, setting with
address@hidden variables @subentry predefined @subentry @code{-v} option,
setting with
@quotation CAUTION
Using @option{-v} to set the values of the built-in
variables may lead to surprising results. @command{awk} will reset the
@@ -3785,15 +3785,15 @@ the abbreviations remain unique.
The full list of @command{gawk}-specific options is provided next.
@item --
address@hidden command line, options, end of
address@hidden options, command-line, end of
address@hidden command line @subentry options @subentry end of
address@hidden options @subentry command-line @subentry end of
Signal the end of the command-line options. The following arguments
are not treated as options even if they begin with @samp{-}. This
interpretation of @option{--} follows the POSIX argument parsing
conventions.
address@hidden @code{-} (hyphen), file names beginning with
address@hidden hyphen (@code{-}), file names beginning with
address@hidden @code{-} (hyphen) @subentry file names beginning with
address@hidden hyphen (@code{-}) @subentry file names beginning with
This is useful if you have @value{FN}s that start with @samp{-},
or in shell scripts, if you have @value{FN}s that will be specified
by the user that could start with @samp{-}.
@@ -3824,7 +3824,7 @@ multibyte characters. This option is an easy way to tell
@command{gawk},
@itemx @option{--traditional}
@cindex @option{-c} option
@cindex @option{--traditional} option
address@hidden compatibility mode (@command{gawk}), specifying
address@hidden compatibility mode (@command{gawk}) @subentry specifying
Specify @dfn{compatibility mode}, in which the GNU extensions to
the @command{awk} language are disabled, so that @command{gawk} behaves just
like BWK @command{awk}.
@@ -3848,15 +3848,15 @@ Print the short version of the General Public License
and then exit.
@cindex @option{--dump-variables} option
@cindex dump all variables of a program
@cindex @file{awkvars.out} file
address@hidden files, @file{awkvars.out}
address@hidden variables, global, printing list of
address@hidden files @subentry @file{awkvars.out}
address@hidden variables @subentry global @subentry printing list of
Print a sorted list of global variables, their types, and final values
to @var{file}. If no @var{file} is provided, print this
list to a file named @file{awkvars.out} in the current directory.
No space is allowed between the @option{-d} and @var{file}, if
@var{file} is supplied.
address@hidden troubleshooting, typographical address@hidden global variables
address@hidden troubleshooting @subentry typographical errors, global variables
Having a list of all global variables is a good way to look for
typographical errors in your programs.
You would also use this option if you have a large program with a lot of
@@ -3883,7 +3883,7 @@ No space is allowed between the @option{-D} and
@var{file}, if
@itemx @option{--source} @var{program-text}
@cindex @option{-e} option
@cindex @option{--source} option
address@hidden source code, mixing
address@hidden source code @subentry mixing
Provide program source code in the @var{program-text}.
This option allows you to mix source code in files with source
code that you enter on the command line.
@@ -3918,7 +3918,7 @@ for more information.
@itemx @option{--exec} @var{file}
@cindex @option{-E} option
@cindex @option{--exec} option
address@hidden @command{awk} programs, location of
address@hidden @command{awk} programs @subentry location of
@cindex CGI, @command{awk} scripts for
Similar to @option{-f}, read @command{awk} program text from @var{file}.
There are two differences from @option{-f}:
@@ -3955,8 +3955,8 @@ with @samp{#!} scripts (@pxref{Executable Scripts}), like
so:
@itemx @option{--gen-pot}
@cindex @option{-g} option
@cindex @option{--gen-pot} option
address@hidden portable object files, generating
address@hidden files, portable object, generating
address@hidden portable object files @subentry generating
address@hidden files @subentry portable object @subentry generating
Analyze the source program and
generate a GNU @command{gettext} portable object template file on standard
output for all string constants that have been marked for translation.
@@ -3968,8 +3968,8 @@ for information about this option.
@cindex @option{-h} option
@cindex @option{--help} option
@cindex GNU long options, printing list of
address@hidden options, printing list of
address@hidden printing, list of options
address@hidden options @subentry printing list of
address@hidden printing @subentry list of options
Print a ``usage'' message summarizing the short- and long-style options
that @command{gawk} accepts and then exit.
@@ -3977,7 +3977,7 @@ that @command{gawk} accepts and then exit.
@itemx @option{--include} @var{source-file}
@cindex @option{-i} option
@cindex @option{--include} option
address@hidden @command{awk} programs, location of
address@hidden @command{awk} programs @subentry location of
Read an @command{awk} source library from @var{source-file}. This option
is completely equivalent to using the @code{@@include} directive inside
your program. It is very similar to the @option{-f} option,
@@ -3997,7 +3997,7 @@ at their beginning. @xref{Changing The Namespace}, for
more information.
@itemx @option{--load} @var{ext}
@cindex @option{-l} option
@cindex @option{--load} option
address@hidden loading extensions
address@hidden loading, extensions
Load a dynamic extension named @var{ext}. Extensions
are stored as system shared libraries.
This option searches for the library using the @env{AWKLIBPATH}
@@ -4011,7 +4011,7 @@ a shared library. This advanced feature is described in
detail in @ref{Dynamic
@itemx @address@hidden@var{value}]
@cindex @option{-l} option
@cindex @option{--lint} option
address@hidden lint checking, issuing warnings
address@hidden lint checking @subentry issuing warnings
@cindex warnings, issuing
Warn about constructs that are dubious or nonportable to
other @command{awk} implementations.
@@ -4046,7 +4046,7 @@ if @command{gawk} is not compiled to use the GNU MPFR and
MP libraries
@cindex @option{--non-decimal-data} option
@cindex hexadecimal address@hidden enabling interpretation of
@cindex octal address@hidden enabling interpretation of
address@hidden troubleshooting, @code{--non-decimal-data} option
address@hidden troubleshooting @subentry @code{--non-decimal-data} option
Enable automatic interpretation of octal and hexadecimal
values in input data
(@pxref{Nondecimal Data}).
@@ -4117,7 +4117,7 @@ in the left margin, and function call counts for each
function.
@cindex @option{-P} option
@cindex @option{--posix} option
@cindex POSIX mode
address@hidden @command{gawk}, address@hidden disabling
address@hidden @command{gawk} @subentry extensions, disabling
Operate in strict POSIX mode. This disables all @command{gawk}
extensions (just like @option{--traditional}) and
disables all extensions not allowed by POSIX.
@@ -4130,13 +4130,13 @@ restrictions apply:
@itemize @value{BULLET}
@cindex newlines
address@hidden whitespace, newlines as
address@hidden whitespace @subentry newlines as
@item
Newlines are not allowed after @samp{?} or @samp{:}
(@pxref{Conditional Exp}).
address@hidden @code{FS} variable, TAB character as
address@hidden @code{FS} variable @subentry TAB character as
@item
Specifying @samp{-Ft} on the command line does not set the value
of @code{FS} to be a single TAB character
@@ -4151,8 +4151,8 @@ data (@pxref{Locales}).
@c @cindex automatic warnings
@c @cindex warnings, automatic
address@hidden @option{--traditional} option, @code{--posix} option and
address@hidden @option{--posix} option, @code{--traditional} option and
address@hidden @option{--traditional} option @subentry @code{--posix} option and
address@hidden @option{--posix} option @subentry @code{--traditional} option and
If you supply both @option{--traditional} and @option{--posix} on the
command line, @option{--posix} takes precedence. @command{gawk}
issues a warning if both options are supplied.
@@ -4161,7 +4161,7 @@ issues a warning if both options are supplied.
@itemx @option{--re-interval}
@cindex @option{-r} option
@cindex @option{--re-interval} option
address@hidden regular expressions, interval expressions and
address@hidden regular expressions @subentry interval expressions and
Allow interval expressions
(@pxref{Regexp Operators})
in regexps.
@@ -4201,7 +4201,7 @@ Warn about constructs that are not available in the
original version of
@itemx @option{--version}
@cindex @option{-V} option
@cindex @option{--version} option
address@hidden @command{gawk}, versions of, information address@hidden printing
address@hidden @command{gawk} @subentry versions of @subentry information
about, printing
Print version information for this particular copy of @command{gawk}.
This allows you to determine if your copy of @command{gawk} is up to date
with respect to whatever the Free Software Foundation is currently
@@ -4214,14 +4214,14 @@ As long as program text has been supplied,
any other options are flagged as invalid with a warning message but
are otherwise ignored.
address@hidden @option{-F} option, @option{-Ft} sets @code{FS} to TAB
address@hidden @option{-F} option @subentry @option{-Ft} sets @code{FS} to TAB
In compatibility mode, as a special case, if the value of @var{fs} supplied
to the @option{-F} option is @samp{t}, then @code{FS} is set to the TAB
character (@code{"\t"}). This is true only for @option{--traditional} and not
for @option{--posix}
(@pxref{Field Separators}).
address@hidden @option{-f} option, multiple uses
address@hidden @option{-f} option @subentry multiple uses
The @option{-f} option may be used more than once on the command line.
If it is, @command{awk} reads its program source from all of the named files,
as
if they had been concatenated together into one big file. This is
@@ -4255,7 +4255,7 @@ uses the first nonoption command-line argument as the
text of the
program source code.
@cindex @env{POSIXLY_CORRECT} environment variable
address@hidden lint checking, @env{POSIXLY_CORRECT} environment variable
address@hidden lint checking @subentry @env{POSIXLY_CORRECT} environment
variable
@cindex POSIX mode
If the environment variable @env{POSIXLY_CORRECT} exists,
then @command{gawk} behaves in strict POSIX mode, exactly as if
@@ -4277,7 +4277,7 @@ POSIXLY_CORRECT=true
export POSIXLY_CORRECT
@end example
address@hidden @command{csh} utility, @env{POSIXLY_CORRECT} environment variable
address@hidden @command{csh} utility @subentry @env{POSIXLY_CORRECT}
environment variable
For a C shell-compatible
shell,@footnote{Not recommended.}
you would add this line to the @file{.login} file in your home directory:
@@ -4286,15 +4286,15 @@ you would add this line to the @file{.login} file in
your home directory:
setenv POSIXLY_CORRECT true
@end example
address@hidden portability, @env{POSIXLY_CORRECT} environment variable
address@hidden portability @subentry @env{POSIXLY_CORRECT} environment variable
Having @env{POSIXLY_CORRECT} set is not recommended for daily use,
but it is good for testing the portability of your programs to other
environments.
@node Other Arguments
@section Other Command-Line Arguments
address@hidden command line, arguments
address@hidden arguments, command-line
address@hidden command line @subentry arguments
address@hidden arguments @subentry command-line
Any additional arguments on the command line are normally treated as
input files to be processed in the order specified. However, an
@@ -4307,10 +4307,10 @@ file at all. (See @ref{Assignment Options}.) In the
following example,
awk -f program.awk file1 count=1 file2
@end example
address@hidden @command{gawk}, @code{ARGIND} variable in
address@hidden @code{ARGIND} variable, command-line arguments
address@hidden @command{gawk} @subentry @code{ARGIND} variable in
address@hidden @code{ARGIND} variable @subentry command-line arguments
@cindex @code{ARGV} array, indexing into
address@hidden @code{ARGC}/@code{ARGV} variables, command-line arguments
address@hidden @code{ARGC}/@code{ARGV} variables @subentry command-line
arguments
All the command-line arguments are made available to your @command{awk}
program in the
@code{ARGV} array (@pxref{Built-in Variables}). Command-line options
and the program text (if present) are omitted from @code{ARGV}.
@@ -4324,7 +4324,7 @@ Changing @code{ARGC} and @code{ARGV} in your
@command{awk} program lets
you control how @command{awk} processes the input files; this is described
in more detail in @ref{ARGC and ARGV}.
address@hidden input files, variable assignments and
address@hidden input files @subentry variable assignments and
@cindex variable assignments and input files
The distinction between @value{FN} arguments and variable-assignment
arguments is made when @command{awk} is about to open the next input file.
@@ -4339,7 +4339,7 @@ variables assigned in this fashion are @emph{not}
available inside a
(@pxref{BEGIN/END}),
because such rules are run before @command{awk} begins scanning the argument
list.
address@hidden dark corner, escape sequences
address@hidden dark corner @subentry escape sequences
The variable values given on the command line are processed for escape
sequences (@pxref{Escape Sequences}).
@value{DARKCORNER}
@@ -4360,7 +4360,7 @@ output formats, before scanning the @value{DF}s. It is
also useful for
controlling state if multiple passes are needed over a @value{DF}. For
example:
address@hidden files, multiple passes over
address@hidden files @subentry multiple passes over
@example
awk 'pass == 1 @{ @var{pass 1 stuff} @}
pass == 2 @{ @var{pass 2 stuff} @}' pass=1 mydata pass=2 mydata
@@ -4421,9 +4421,9 @@ behaves.
@node AWKPATH Variable
@subsection The @env{AWKPATH} Environment Variable
@cindex @env{AWKPATH} environment variable
address@hidden directories, searching for source files
address@hidden search paths, for source files
address@hidden differences in @command{awk} and @command{gawk}, @env{AWKPATH}
environment variable
address@hidden directories @subentry searching for source files
address@hidden search paths @subentry for source files
address@hidden differences in @command{awk} and @command{gawk} @subentry
@env{AWKPATH} environment variable
@ifinfo
The previous @value{SECTION} described how @command{awk} program files can be
named
on the command line with the @option{-f} option.
@@ -4507,9 +4507,9 @@ found, and @command{gawk} no longer needs to use
@env{AWKPATH}.
@node AWKLIBPATH Variable
@subsection The @env{AWKLIBPATH} Environment Variable
@cindex @env{AWKLIBPATH} environment variable
address@hidden directories, searching for loadable extensions
address@hidden search paths, for loadable extensions
address@hidden differences in @command{awk} and @command{gawk},
@code{AWKLIBPATH} environment variable
address@hidden directories @subentry searching for loadable extensions
address@hidden search paths @subentry for loadable extensions
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{AWKLIBPATH} environment variable
The @env{AWKLIBPATH} environment variable is similar to the @env{AWKPATH}
variable, but it is used to search for loadable extensions (stored as
@@ -4639,7 +4639,7 @@ calls from the GNU C library to help track down possible
memory leaks.
@node Exit Status
@section @command{gawk}'s Exit Status
address@hidden exit status, of @command{gawk}
address@hidden exit status @subentry of @command{gawk}
If the @code{exit} statement is used with a value
(@pxref{Exit Statement}), then @command{gawk} exits with
the numeric value given to it.
@@ -4793,7 +4793,7 @@ This @value{SECTION} describes a feature that is specific
to @command{gawk}.
@cindex @code{@@load} directive
@cindex loading extensions, @code{@@load} directive
address@hidden extensions, loading, @code{@@load} directive
address@hidden extensions @subentry loading @subentry @code{@@load} directive
The @code{@@load} keyword can be used to read external @command{awk} extensions
(stored as system shared libraries).
This allows you to link in compiled code that may offer superior
@@ -4836,8 +4836,8 @@ It also describes the @code{ordchr} extension.
@c update this section for each release!
address@hidden options, deprecated
address@hidden features, deprecated
address@hidden options @subentry deprecated
address@hidden features @subentry deprecated
@cindex obsolete features
This @value{SECTION} describes features and/or command-line options from
previous releases of @command{gawk} that either are not available in the
@@ -4859,7 +4859,7 @@ in case some option becomes obsolete in a future version
of @command{gawk}.
@node Undocumented
@section Undocumented Options and Features
@cindex undocumented features
address@hidden features, undocumented
address@hidden features @subentry undocumented
@cindex Skywalker, Luke
@cindex Kenobi, Obi-Wan
@cindex jedi knights
@@ -4869,7 +4869,7 @@ in case some option becomes obsolete in a future version
of @command{gawk}.
@author Obi-Wan
@end quotation
address@hidden shells, sea
address@hidden shells @subentry sea
This @value{SECTION} intentionally left
blank.
@@ -5010,8 +5010,8 @@ set of strings.
Because regular expressions are such a fundamental part of @command{awk}
programming, their format and use deserve a separate @value{CHAPTER}.
address@hidden forward slash (@code{/}) to enclose regular expressions
address@hidden @code{/} (forward slash) to enclose regular expressions
address@hidden forward slash (@code{/}) @subentry to enclose regular expressions
address@hidden @code{/} (forward slash) @subentry to enclose regular expressions
A regular expression enclosed in slashes (@samp{/})
is an @command{awk} pattern that matches every input record whose text
belongs to that set.
@@ -5043,8 +5043,8 @@ regular expressions work, we present more complicated
instances.
@node Regexp Usage
@section How to Use Regular Expressions
address@hidden patterns, regular expressions as
address@hidden regular expressions, as patterns
address@hidden patterns @subentry regular expressions as
address@hidden regular expressions @subentry as patterns
A regular expression can be used as a pattern by enclosing it in
slashes. Then the regular expression is tested against the
entire text of each record. (Normally, it only needs
@@ -5060,16 +5060,16 @@ $ @kbd{awk '/li/ @{ print $2 @}' mail-list}
@print{} 555-3430
@end example
address@hidden regular expressions, operators
address@hidden operators, string-matching
address@hidden regular expressions @subentry operators
address@hidden operators @subentry string-matching
@c @cindex operators, @code{~}
@cindex string-matching operators
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
@c @cindex operators, @code{!~}
address@hidden @code{if} statement, use of regexps in
address@hidden @code{if} statement @subentry use of regexps in
@cindex @code{while} statement, use of regexps in
@cindex @address@hidden statement, use of regexps in
@c @cindex statements, @code{if}
@@ -5138,9 +5138,9 @@ a @dfn{regexp constant}, much like @code{5.27} is a
numeric constant and
@node Escape Sequences
@section Escape Sequences
address@hidden escape sequences, in strings
address@hidden backslash (@code{\}), in escape sequences
address@hidden @code{\} (backslash), in escape sequences
address@hidden escape sequences @subentry in strings
address@hidden backslash (@code{\}) @subentry in escape sequences
address@hidden @code{\} (backslash) @subentry in escape sequences
Some characters cannot be included literally in string constants
(@code{"foo"}) or regexp constants (@code{/foo/}).
Instead, they should be represented with @dfn{escape sequences},
@@ -5175,45 +5175,45 @@ sequences apply to both string constants and regexp
constants:
A literal backslash, @samp{\}.
@c @cindex @command{awk} language, V.4 version
address@hidden @code{\} (backslash), @code{\a} escape sequence
address@hidden backslash (@code{\}), @code{\a} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\a} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\a} escape sequence
@item \a
The ``alert'' character, @kbd{Ctrl-g}, ASCII code 7 (BEL).
(This often makes some sort of audible noise.)
address@hidden @code{\} (backslash), @code{\b} escape sequence
address@hidden backslash (@code{\}), @code{\b} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\b} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\b} escape sequence
@item \b
Backspace, @kbd{Ctrl-h}, ASCII code 8 (BS).
address@hidden @code{\} (backslash), @code{\f} escape sequence
address@hidden backslash (@code{\}), @code{\f} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\f} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\f} escape sequence
@item \f
Formfeed, @kbd{Ctrl-l}, ASCII code 12 (FF).
address@hidden @code{\} (backslash), @code{\n} escape sequence
address@hidden backslash (@code{\}), @code{\n} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\n} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\n} escape sequence
@item \n
Newline, @kbd{Ctrl-j}, ASCII code 10 (LF).
address@hidden @code{\} (backslash), @code{\r} escape sequence
address@hidden backslash (@code{\}), @code{\r} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\r} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\r} escape sequence
@item \r
Carriage return, @kbd{Ctrl-m}, ASCII code 13 (CR).
address@hidden @code{\} (backslash), @code{\t} escape sequence
address@hidden backslash (@code{\}), @code{\t} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\t} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\t} escape sequence
@item \t
Horizontal TAB, @kbd{Ctrl-i}, ASCII code 9 (HT).
@c @cindex @command{awk} language, V.4 version
address@hidden @code{\} (backslash), @code{\v} escape sequence
address@hidden backslash (@code{\}), @code{\v} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\v} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\v} escape sequence
@item \v
Vertical TAB, @kbd{Ctrl-k}, ASCII code 11 (VT).
address@hidden @code{\} (backslash), @address@hidden escape sequence
address@hidden backslash (@code{\}), @address@hidden escape sequence
address@hidden @code{\} (backslash) @subentry @address@hidden escape sequence
address@hidden backslash (@code{\}) @subentry @address@hidden escape sequence
@item address@hidden
The octal value @var{nnn}, where @var{nnn} stands for 1 to 3 digits
between @samp{0} and @samp{7}. For example, the code for the ASCII ESC
@@ -5221,10 +5221,10 @@ between @samp{0} and @samp{7}. For example, the code
for the ASCII ESC
@c @cindex @command{awk} language, V.4 version
@c @cindex @command{awk} language, POSIX version
address@hidden @code{\} (backslash), @code{\x} escape sequence
address@hidden backslash (@code{\}), @code{\x} escape sequence
address@hidden common extensions, @code{\x} escape sequence
address@hidden extensions, address@hidden @code{\x} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\x} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\x} escape sequence
address@hidden common extensions @subentry @code{\x} escape sequence
address@hidden extensions @subentry common, @code{\x} escape sequence
@item address@hidden@dots{}
The hexadecimal value @var{hh}, where @var{hh} stands for a sequence
of hexadecimal digits (@address@hidden, and either @address@hidden
@@ -5245,8 +5245,8 @@ As of @value{PVERSION} 4.2, only two digits
are processed.
@end quotation
address@hidden @code{\} (backslash), @code{\/} escape sequence
address@hidden backslash (@code{\}), @code{\/} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\/} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\/} escape sequence
@item \/
A literal slash (necessary for regexp constants only).
This sequence is used when you want to write a regexp
@@ -5257,8 +5257,8 @@ Because the regexp is delimited by
slashes, you need to escape any slash that is part of the pattern,
in order to tell @command{awk} to keep processing the rest of the regexp.
address@hidden @code{\} (backslash), @code{\"} escape sequence
address@hidden backslash (@code{\}), @code{\"} escape sequence
address@hidden @code{\} (backslash) @subentry @code{\"} escape sequence
address@hidden backslash (@code{\}) @subentry @code{\"} escape sequence
@item \"
A literal double quote (necessary for string constants only).
This sequence is used when you want to write a string
@@ -5280,20 +5280,20 @@ means that the next character should be taken
literally, even if it would
normally be a regexp operator. For example, @code{/a\+b/} matches the three
characters @samp{a+b}.
address@hidden backslash (@code{\}), in escape sequences
address@hidden @code{\} (backslash), in escape sequences
address@hidden backslash (@code{\}) @subentry in escape sequences
address@hidden @code{\} (backslash) @subentry in escape sequences
@cindex portability
For complete portability, do not use a backslash before any character not
shown in the previous list or that is not an operator.
@c 11/2014: Moved so as to not stack sidebars
@sidebar Backslash Before Regular Characters
address@hidden portability, backslash in escape sequences
address@hidden POSIX @command{awk}, backslashes in string constants
address@hidden backslash (@code{\}), in escape sequences, POSIX and
address@hidden @code{\} (backslash), in escape sequences, POSIX and
address@hidden portability @subentry backslash in escape sequences
address@hidden POSIX @command{awk} @subentry backslashes in string constants
address@hidden backslash (@code{\}) @subentry in escape sequences @subentry
POSIX and
address@hidden @code{\} (backslash) @subentry in escape sequences @subentry
POSIX and
address@hidden troubleshooting, backslash before nonspecial character
address@hidden troubleshooting @subentry backslash before nonspecial character
If you place a backslash in a string constant before something that is
not one of the characters previously listed, POSIX @command{awk} purposely
leaves what happens as undefined. There are two choices:
@@ -5312,8 +5312,8 @@ surrounded by whitespace as the field separator. There
should be
two backslashes in the string: @samp{FS = @w{"[ \t]+\\|[ \t]+"}}.)
@c I did this! This is why I added the warning.
address@hidden @command{gawk}, escape sequences
address@hidden Unix @command{awk}, backslashes in escape sequences
address@hidden @command{gawk} @subentry escape sequences
address@hidden Unix @command{awk} @subentry backslashes in escape sequences
@cindex @command{mawk} utility
@item Leave the backslash alone
Some other @command{awk} implementations do this.
@@ -5350,7 +5350,7 @@ escape to represent a regexp metacharacter.
Does @command{awk} treat the character as a literal character or as a regexp
operator?
address@hidden dark corner, escape sequences, for metacharacters
address@hidden dark corner @subentry escape sequences @subentry for
metacharacters
Historically, such characters were taken literally.
@value{DARKCORNER}
However, the POSIX standard indicates that they should be treated
@@ -5363,7 +5363,7 @@ escape sequences literally when used in regexp constants.
Thus,
@node Regexp Operators
@section Regular Expression Operators
address@hidden regular expressions, operators
address@hidden regular expressions @subentry operators
@cindex metacharacters in regular expressions
You can combine regular expressions with special characters,
@@ -5392,17 +5392,17 @@ sequences and that are not listed here stand for
themselves:
@c Use @asis so the docbook comes out ok. Sigh.
@table @asis
address@hidden backslash (@code{\}), regexp operator
address@hidden @code{\} (backslash), regexp operator
address@hidden backslash (@code{\}) @subentry regexp operator
address@hidden @code{\} (backslash) @subentry regexp operator
@item @code{\}
This suppresses the special meaning of a character when
matching. For example, @samp{\$}
matches the character @samp{$}.
address@hidden regular expressions, anchors in
address@hidden Texinfo, chapter beginnings in files
address@hidden @code{^} (caret), regexp operator
address@hidden caret (@code{^}), regexp operator
address@hidden regular expressions @subentry anchors in
address@hidden Texinfo @subentry chapter beginnings in files
address@hidden @code{^} (caret) @subentry regexp operator
address@hidden caret (@code{^}) @subentry regexp operator
@item @code{^}
This matches the beginning of a string. @samp{^@@chapter}
matches @samp{@@chapter} at the beginning of a string,
@@ -5419,8 +5419,8 @@ The condition is not true in the following example:
if ("line1\nLINE 2" ~ /^L/) @dots{}
@end example
address@hidden @code{$} (dollar sign), regexp operator
address@hidden dollar sign (@code{$}), regexp operator
address@hidden @code{$} (dollar sign) @subentry regexp operator
address@hidden dollar sign (@code{$}) @subentry regexp operator
@item @code{$}
This is similar to @samp{^}, but it matches only at the end of a string.
For example, @samp{p$}
@@ -5434,7 +5434,7 @@ The condition in the following example is not true:
if ("line1\nLINE 2" ~ /1$/) @dots{}
@end example
address@hidden @code{.} (period), regexp operator
address@hidden @code{.} (period) @subentry regexp operator
@cindex period (@code{.}), regexp operator
@item @code{.} (period)
This matches any single character,
@@ -5444,7 +5444,7 @@ concatenation, we can make a regular expression such as
@samp{U.A}, which
matches any three-character sequence that begins with @samp{U} and ends
with @samp{A}.
address@hidden POSIX @command{awk}, period (@code{.})@comma{} using
address@hidden POSIX @command{awk} @subentry period (@code{.}), using
In strict POSIX mode (@pxref{Options}),
@samp{.} does not match the @sc{nul}
character, which is a character with all bits equal to zero.
@@ -5468,7 +5468,7 @@ discussion of what can be inside the square brackets of a
bracket expression
is given in
@ref{Bracket Expressions}.
address@hidden bracket expressions, complemented
address@hidden bracket expressions @subentry complemented
@item @address@hidden@code{]}
This is a @dfn{complemented bracket expression}. The first character after
the @samp{[} @emph{must} be a @samp{^}. It matches any characters
@@ -5488,8 +5488,8 @@ a lowercase English vowel.
The alternation applies to the largest possible regexps on either side.
address@hidden @code{()} (parentheses), regexp operator
address@hidden parentheses @code{()}, regexp operator
address@hidden @code{()} (parentheses) @subentry regexp operator
address@hidden parentheses @code{()} @subentry regexp operator
@item @code{(address@hidden@code{)}
Parentheses are used for grouping in regular expressions, as in
arithmetic. They can be used to concatenate regular expressions
@@ -5499,8 +5499,8 @@ containing the alternation operator, @samp{|}. For
example,
(These are Texinfo formatting control sequences. The @samp{+} is
explained further on in this list.)
address@hidden @code{*} (asterisk), @code{*} operator, as regexp operator
address@hidden asterisk (@code{*}), @code{*} operator, as regexp operator
address@hidden @code{*} (asterisk) @subentry @code{*} operator @subentry as
regexp operator
address@hidden asterisk (@code{*}) @subentry @code{*} operator @subentry as
regexp operator
@item @code{*}
This symbol means that the preceding regular expression should be
repeated as many times as necessary to find a match. For example, @samp{ph*}
@@ -5518,16 +5518,16 @@ Second, @samp{*} finds as many repetitions as possible.
If the text
to be matched is @samp{phhhhhhhhhhhhhhooey}, @samp{ph*} matches all of
the @samp{h}s.
address@hidden @code{+} (plus sign), regexp operator
address@hidden plus sign (@code{+}), regexp operator
address@hidden @code{+} (plus sign) @subentry regexp operator
address@hidden plus sign (@code{+}) @subentry regexp operator
@item @code{+}
This symbol is similar to @samp{*}, except that the preceding expression must
be
matched at least once. This means that @samp{wh+y}
would match @samp{why} and @samp{whhy}, but not @samp{wy}, whereas
@samp{wh*y} would match all three.
address@hidden @code{?} (question mark), regexp operator
address@hidden question mark (@code{?}), regexp operator
address@hidden @code{?} (question mark) @subentry regexp operator
address@hidden question mark (@code{?}) @subentry regexp operator
@item @code{?}
This symbol is similar to @samp{*}, except that the preceding expression can be
matched either once or not at all. For example, @samp{fe?d}
@@ -5558,15 +5558,15 @@ Matches @samp{whhy}, @samp{whhhy}, and so on.
@end table
@cindex precedence, regexp operators
address@hidden regular expressions, operators, precedence of
address@hidden regular expressions @subentry operators @subentry precedence of
In regular expressions, the @samp{*}, @samp{+}, and @samp{?} operators,
as well as the braces @address@hidden and @address@hidden,
have
the highest precedence, followed by concatenation, and finally by @samp{|}.
As in arithmetic, parentheses can change how operators are grouped.
address@hidden POSIX @command{awk}, regular expressions and
address@hidden @command{gawk}, regular expressions, precedence
address@hidden POSIX @command{awk} @subentry regular expressions and
address@hidden @command{gawk} @subentry regular expressions @subentry precedence
In POSIX @command{awk} and @command{gawk}, the @samp{*}, @samp{+}, and
@samp{?} operators stand for themselves when there is nothing in the
regexp that precedes them. For example, @code{/+/} matches a literal
@@ -5576,12 +5576,12 @@ usage as a syntax error.
@node Interval Expressions
@subsection Some Notes On Interval Expressions
address@hidden POSIX @command{awk}, interval expressions in
address@hidden POSIX @command{awk} @subentry interval expressions in
Interval expressions were not traditionally available in @command{awk}.
They were added as part of the POSIX standard to make @command{awk}
and @command{egrep} consistent with each other.
address@hidden @command{gawk}, interval expressions and
address@hidden @command{gawk} @subentry interval expressions and
Initially, because old programs may use @address@hidden and @address@hidden in
regexp
constants,
@command{gawk} did @emph{not} match interval expressions
@@ -5614,7 +5614,7 @@ when in compatibility mode (@pxref{Options}).
@node Bracket Expressions
@section Using Bracket Expressions
@cindex bracket expressions
address@hidden bracket expressions, range expressions
address@hidden bracket expressions @subentry range expressions
@cindex range expressions (regexps)
@cindex character lists in regular expressions
@@ -5638,12 +5638,12 @@ the range 0--256). To match a range of characters
where the endpoints
of the range are larger than 256, enter the multibyte encodings of
the characters directly.
address@hidden @code{\} (backslash), in bracket expressions
address@hidden backslash (@code{\}), in bracket expressions
address@hidden @code{^} (caret), in bracket expressions
address@hidden caret (@code{^}), in bracket expressions
address@hidden @code{-} (hyphen), in bracket expressions
address@hidden hyphen (@code{-}), in bracket expressions
address@hidden @code{\} (backslash) @subentry in bracket expressions
address@hidden backslash (@code{\}) @subentry in bracket expressions
address@hidden @code{^} (caret) @subentry in bracket expressions
address@hidden caret (@code{^}) @subentry in bracket expressions
address@hidden @code{-} (hyphen) @subentry in bracket expressions
address@hidden hyphen (@code{-}) @subentry in bracket expressions
To include one of the characters @samp{\}, @samp{]}, @samp{-}, or @samp{^} in a
bracket expression, put a @samp{\} in front of it. For example:
@@ -5657,7 +5657,7 @@ Additionally, if you place @samp{]} right after the
opening
@samp{[}, the closing bracket is treated as one of the
characters to be matched.
address@hidden POSIX @command{awk}, bracket expressions and
address@hidden POSIX @command{awk} @subentry bracket expressions and
@cindex Extended Regular Expressions (EREs)
@cindex EREs (Extended Regular Expressions)
@cindex @command{egrep} utility
@@ -5669,8 +5669,8 @@ of the POSIX specification for Extended Regular
Expressions (EREs).
POSIX EREs are based on the regular expressions accepted by the
traditional @command{egrep} utility.
address@hidden bracket expressions, character classes
address@hidden POSIX @command{awk}, bracket expressions and, character classes
address@hidden bracket expressions @subentry character classes
address@hidden POSIX @command{awk} @subentry bracket expressions and @subentry
character classes
@dfn{Character classes} are a feature introduced in the POSIX standard.
A character class is a special notation for describing
lists of characters that have a specific attribute, but the
@@ -5752,8 +5752,8 @@ treat @code{[:blank:]} like @code{[:space:]}, incorrectly
matching
more characters than they should. Caveat Emptor.
@end quotation
address@hidden bracket expressions, collating elements
address@hidden bracket expressions, non-ASCII
address@hidden bracket expressions @subentry collating elements
address@hidden bracket expressions @subentry non-ASCII
@cindex collating elements
Two additional special sequences can appear in bracket expressions.
These apply to non-ASCII character sets, which can have single symbols
@@ -5764,7 +5764,7 @@ and a grave-accented address@hidden'' are equivalent.)
These sequences are:
@table @asis
address@hidden bracket expressions, collating symbols
address@hidden bracket expressions @subentry collating symbols
@cindex collating symbols
@item Collating symbols
Multicharacter collating elements enclosed between
@@ -5772,7 +5772,7 @@ Multicharacter collating elements enclosed between
then @samp{[[.ch.]]} is a regexp that matches this collating element, whereas
@samp{[ch]} is a regexp that matches either @samp{c} or @samp{h}.
address@hidden bracket expressions, equivalence classes
address@hidden bracket expressions @subentry equivalence classes
@item Equivalence classes
Locale-specific names for a list of
characters that are equal. The name is enclosed between
@@ -5784,9 +5784,9 @@ that matches any of @samp{e}, @address@hidden,
@samp{@'e}, or @address@hidden
These features are very valuable in non-English-speaking locales.
address@hidden internationalization, localization, character classes
address@hidden @command{gawk}, character classes and
address@hidden POSIX @command{awk}, bracket expressions and, character classes
address@hidden internationalization @subentry localization @subentry character
classes
address@hidden @command{gawk} @subentry character classes and
address@hidden POSIX @command{awk} @subentry bracket expressions and @subentry
character classes
@quotation CAUTION
The library functions that @command{gawk} uses for regular
expression matching currently recognize only POSIX character classes;
@@ -5801,7 +5801,7 @@ taken literally. This is also true of @samp{.} and
@samp{*}.
@node Leftmost Longest
@section How Much Text Matches?
address@hidden regular expressions, leftmost longest match
address@hidden regular expressions @subentry leftmost longest match
@c @cindex matching, leftmost longest
Consider the following:
@@ -5840,12 +5840,12 @@ and also @pxref{Field Separators}).
@node Computed Regexps
@section Using Dynamic Regexps
address@hidden regular expressions, computed
address@hidden regular expressions, dynamic
address@hidden @code{~} (tilde), @code{~} operator
address@hidden regular expressions @subentry computed
address@hidden regular expressions @subentry dynamic
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
@c @cindex operators, @code{~}
@c @cindex operators, @code{!~}
The righthand side of a @samp{~} or @samp{!~} operator need not be a
@@ -5876,11 +5876,11 @@ on the right. This is true of any string-valued
expression (such as
@code{digits_regexp}, shown in the previous example), not just string
constants.
@end quotation
address@hidden regexp constants, slashes vs.@: quotes
address@hidden @code{\} (backslash), in regexp constants
address@hidden backslash (@code{\}), in regexp constants
address@hidden @code{"} (double quote), in regexp constants
address@hidden double quote (@code{"}), in regexp constants
address@hidden regexp constants @subentry slashes vs.@: quotes
address@hidden @code{\} (backslash) @subentry in regexp constants
address@hidden backslash (@code{\}) @subentry in regexp constants
address@hidden @code{"} (double quote) @subentry in regexp constants
address@hidden double quote (@code{"}) @subentry in regexp constants
What difference does it make if the string is
scanned twice? The answer has to do with escape sequences, and particularly
with backslashes. To get a backslash into a regular expression inside a
@@ -5892,8 +5892,8 @@ you have to type @code{"\\*"}. The first backslash
escapes the
second one so that the string actually contains the
two characters @samp{\} and @samp{*}.
address@hidden troubleshooting, regexp constants vs.@: string constants
address@hidden regexp constants, vs.@: string constants
address@hidden troubleshooting @subentry regexp constants vs.@: string constants
address@hidden regexp constants @subentry vs.@: string constants
@cindex string constants, vs.@: regexp constants
Given that you can use both regexp and string constants to describe
regular expressions, which should you use? The answer is ``regexp
@@ -5919,8 +5919,8 @@ intend a regexp match.
@end itemize
@sidebar Using @code{\n} in Bracket Expressions of Dynamic Regexps
address@hidden regular expressions, dynamic, with embedded newlines
address@hidden newlines, in dynamic regexps
address@hidden regular expressions @subentry dynamic @subentry with embedded
newlines
address@hidden newlines @subentry in dynamic regexps
Some older versions of @command{awk} do not allow the newline
character to be used inside a bracket expression for a dynamic regexp:
@@ -5934,7 +5934,7 @@ $ @kbd{awk '$0 ~ "[ \t\n]"'}
@error{} $0 ~ "[ >>> \t\n]" <<<
@end example
address@hidden newlines, in regexp constants
address@hidden newlines @subentry in regexp constants
But a newline in a regexp constant works with no problem:
@example
@@ -5953,10 +5953,10 @@ occur often in practice, but it's worth noting for
future reference.
@c This section adapted (long ago) from the regex-0.12 manual
address@hidden regular expressions, operators, @command{gawk}
address@hidden @command{gawk}, regular expressions, operators
address@hidden operators, GNU-specific
address@hidden regular expressions, operators, for words
address@hidden regular expressions @subentry operators @subentry @command{gawk}
address@hidden @command{gawk} @subentry regular expressions @subentry operators
address@hidden operators @subentry GNU-specific
address@hidden regular expressions @subentry operators @subentry for words
@cindex word, regexp definition of
GNU software that deals with regular expressions provides a number of
additional regexp operators. These operators are described in this
@@ -5968,55 +5968,55 @@ or underscores (@samp{_}):
@table @code
@c @cindex operators, @code{\s} (@command{gawk})
address@hidden backslash (@code{\}), @code{\s} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\s} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\s} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\s} operator
(@command{gawk})
@item \s
Matches any whitespace character.
Think of it as shorthand for
@address@hidden:space:]]}}.
@c @cindex operators, @code{\S} (@command{gawk})
address@hidden backslash (@code{\}), @code{\S} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\S} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\S} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\S} operator
(@command{gawk})
@item \S
Matches any character that is not whitespace.
Think of it as shorthand for
@address@hidden:space:]]}}.
@c @cindex operators, @code{\w} (@command{gawk})
address@hidden backslash (@code{\}), @code{\w} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\w} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\w} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\w} operator
(@command{gawk})
@item \w
Matches any word-constituent character---that is, it matches any
letter, digit, or underscore. Think of it as shorthand for
@address@hidden:alnum:]_]}}.
@c @cindex operators, @code{\W} (@command{gawk})
address@hidden backslash (@code{\}), @code{\W} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\W} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\W} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\W} operator
(@command{gawk})
@item \W
Matches any character that is not word-constituent.
Think of it as shorthand for
@address@hidden:alnum:]_]}}.
@c @cindex operators, @code{\<} (@command{gawk})
address@hidden backslash (@code{\}), @code{\<} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\<} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\<} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\<} operator
(@command{gawk})
@item \<
Matches the empty string at the beginning of a word.
For example, @code{/\<away/} matches @samp{away} but not
@samp{stowaway}.
@c @cindex operators, @code{\>} (@command{gawk})
address@hidden backslash (@code{\}), @code{\>} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\>} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\>} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\>} operator
(@command{gawk})
@item \>
Matches the empty string at the end of a word.
For example, @code{/stow\>/} matches @samp{stow} but not @samp{stowaway}.
@c @cindex operators, @code{\y} (@command{gawk})
address@hidden backslash (@code{\}), @code{\y} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\y} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\y} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\y} operator
(@command{gawk})
@cindex word address@hidden matching
@item \y
Matches the empty string at either the beginning or the
@@ -6024,8 +6024,8 @@ end of a word (i.e., the word address@hidden). For
example, @samp{\yballs?\y
matches either @samp{ball} or @samp{balls}, as a separate word.
@c @cindex operators, @code{\B} (@command{gawk})
address@hidden backslash (@code{\}), @code{\B} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\B} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\B} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\B} operator
(@command{gawk})
@item \B
Matches the empty string that occurs between two
word-constituent characters. For example,
@@ -6033,9 +6033,9 @@ word-constituent characters. For example,
@samp{\B} is essentially the opposite of @samp{\y}.
@end table
address@hidden buffers, operators for
address@hidden regular expressions, operators, for buffers
address@hidden operators, string-matching, for buffers
address@hidden buffers @subentry operators for
address@hidden regular expressions @subentry operators @subentry for buffers
address@hidden operators @subentry string-matching @subentry for buffers
There are two other operators that work on buffers. In Emacs, a
@dfn{buffer} is, naturally, an Emacs buffer.
Other GNU programs, including @command{gawk},
@@ -6045,31 +6045,31 @@ The operators are:
@table @code
@item \`
@c @cindex operators, @code{\`} (@command{gawk})
address@hidden backslash (@code{\}), @code{\`} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\`} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\`} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\`} operator
(@command{gawk})
Matches the empty string at the
beginning of a buffer (string)
@c @cindex operators, @code{\'} (@command{gawk})
address@hidden backslash (@code{\}), @code{\'} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\'} operator (@command{gawk})
address@hidden backslash (@code{\}) @subentry @code{\'} operator
(@command{gawk})
address@hidden @code{\} (backslash) @subentry @code{\'} operator
(@command{gawk})
@item \'
Matches the empty string at the
end of a buffer (string)
@end table
address@hidden @code{^} (caret), regexp operator
address@hidden caret (@code{^}), regexp operator
address@hidden @code{?} (question mark), regexp operator
address@hidden question mark (@code{?}), regexp operator
address@hidden @code{^} (caret) @subentry regexp operator
address@hidden caret (@code{^}) @subentry regexp operator
address@hidden @code{?} (question mark) @subentry regexp operator
address@hidden question mark (@code{?}) @subentry regexp operator
Because @samp{^} and @samp{$} always work in terms of the beginning
and end of strings, these operators don't add any new capabilities
for @command{awk}. They are provided for compatibility with other
GNU software.
address@hidden @command{gawk}, word-boundary operator
address@hidden @command{gawk} @subentry word-boundary operator
@cindex word-boundary operator (@command{gawk})
address@hidden operators, word-boundary (@command{gawk})
address@hidden operators @subentry word-boundary (@command{gawk})
In other GNU software, the word-boundary operator is @samp{\b}. However,
that conflicts with the @command{awk} language's definition of @samp{\b}
as backspace, so @command{gawk} uses a different letter.
@@ -6078,8 +6078,8 @@ GNU operators, but this was deemed too confusing. The
current
method of using @samp{\y} for the GNU @samp{\b} appears to be the
lesser of two evils.
address@hidden regular expressions, @command{gawk}, command-line options
address@hidden @command{gawk}, command-line options, and regular expressions
address@hidden regular expressions @subentry @command{gawk} @subentry
command-line options
address@hidden @command{gawk} @subentry command-line options @subentry and
regular expressions
The various command-line options
(@pxref{Options})
control how @command{gawk} interprets characters in regexps:
@@ -6122,8 +6122,8 @@ Otherwise, interval expressions are available by default.
@node Case-sensitivity
@section Case Sensitivity in Matching
address@hidden regular expressions, case sensitivity
address@hidden case sensitivity, regexps and
address@hidden regular expressions @subentry case sensitivity
address@hidden case sensitivity @subentry regexps and
Case is normally significant in regular expressions, both when matching
ordinary characters (i.e., not metacharacters) and inside bracket
expressions. Thus, a @samp{w} in a regular expression matches only a lowercase
@@ -6149,15 +6149,15 @@ tolower($1) ~ /foo/ @{ @dots{} @}
converts the first field to lowercase before matching against it.
This works in any POSIX-compliant @command{awk}.
address@hidden @command{gawk}, regular expressions, case sensitivity
address@hidden case sensitivity, @command{gawk}
address@hidden differences in @command{awk} and @command{gawk}, regular
expressions
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @command{gawk} @subentry regular expressions @subentry case
sensitivity
address@hidden case sensitivity @subentry @command{gawk}
address@hidden differences in @command{awk} and @command{gawk} @subentry
regular expressions
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{IGNORECASE} variable, with @code{~} and @code{!~} operators
address@hidden @command{gawk}, @code{IGNORECASE} variable in
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
address@hidden @code{IGNORECASE} variable @subentry with @code{~} and @code{!~}
operators
address@hidden @command{gawk} @subentry @code{IGNORECASE} variable in
@c @cindex variables, @code{IGNORECASE}
Another method, specific to @command{gawk}, is to set the variable
@code{IGNORECASE} to a nonzero value (@pxref{Built-in Variables}).
@@ -6265,7 +6265,7 @@ versions, use @code{tolower()} or @code{toupper()}.
@chapter Reading Input Files
@cindex reading input files
address@hidden input files, reading
address@hidden input files @subentry reading
@cindex input files
@cindex @code{FILENAME} variable
In the typical @command{awk} program,
@@ -6317,8 +6317,8 @@ used with it do not have to be named on the @command{awk}
command line
@node Records
@section How Input Is Split into Records
address@hidden input, splitting into records
address@hidden records, splitting input into
address@hidden input @subentry splitting into records
address@hidden records @subentry splitting input into
@cindex @code{NR} variable
@cindex @code{FNR} variable
@command{awk} divides the input for your program into records and fields.
@@ -6343,7 +6343,7 @@ This mechanism is explained in greater detail shortly.
@node awk split records
@subsection Record Splitting with Standard @command{awk}
address@hidden separators, for records
address@hidden separators @subentry for records
@cindex record separators
Records are separated by a character called the @dfn{record separator}.
By default, the record separator is the newline character.
@@ -6351,8 +6351,8 @@ This is why records are, by default, single lines.
To use a different character for the record separator,
simply assign that character to the predefined variable @code{RS}.
address@hidden record separators, newlines as
address@hidden newlines, as record separators
address@hidden record separators @subentry newlines as
address@hidden newlines @subentry as record separators
@cindex @code{RS} variable
Like any other variable,
the value of @code{RS} can be changed in the @command{awk} program
@@ -6444,8 +6444,8 @@ the newline separating them in the output
is the original newline in the @value{DF}, not the one added by
@command{awk} when it printed the record!
address@hidden record separators, changing
address@hidden separators, for records
address@hidden record separators @subentry changing
address@hidden separators @subentry for records
Another way to change the record separator is on the command line,
using the variable-assignment feature
(@pxref{Other Arguments}):
@@ -6486,7 +6486,7 @@ variable @code{NF} is the number of fields in the current
record.
printing @samp{0} as the result. Most other versions of @command{awk}
also act this way.)
address@hidden dark corner, input files
address@hidden dark corner @subentry input files
Reaching the end of an input file terminates the current input record,
even if the last character in the file is not the character in @code{RS}.
@value{DARKCORNER}
@@ -6505,15 +6505,15 @@ the new value is used to delimit subsequent records,
but the record
currently being processed, as well as records already processed, are not
affected.
address@hidden @command{gawk}, @code{RT} variable in
address@hidden @command{gawk} @subentry @code{RT} variable in
@cindex @code{RT} variable
address@hidden records, terminating
address@hidden records @subentry terminating
@cindex terminating records
address@hidden differences in @command{awk} and @command{gawk}, record
separators
address@hidden differences in @command{awk} and @command{gawk},
@code{RS}/@code{RT} variables
address@hidden regular expressions, as record separators
address@hidden record separators, regular expressions as
address@hidden separators, for records, regular expressions as
address@hidden differences in @command{awk} and @command{gawk} @subentry record
separators
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{RS}/@code{RT} variables
address@hidden regular expressions @subentry as record separators
address@hidden record separators @subentry regular expressions as
address@hidden separators @subentry for records @subentry regular expressions as
After the end of the record has been determined, @command{gawk}
sets the variable @code{RT} to the text in the input that matched
@code{RS}.
@@ -6521,8 +6521,8 @@ sets the variable @code{RT} to the text in the input that
matched
@node gawk split records
@subsection Record Splitting with @command{gawk}
address@hidden common extensions, @code{RS} as a regexp
address@hidden extensions, address@hidden @code{RS} as a regexp
address@hidden common extensions @subentry @code{RS} as a regexp
address@hidden extensions @subentry common, @code{RS} as a regexp
When using @command{gawk}, the value of @code{RS} is not limited to a
one-character string. If it contains more than one character, it is
treated as a regular expression
@@ -6586,9 +6586,9 @@ that happens to contain newline characters.
It is thus best to avoid anchor metacharacters in the value of @code{RS}.
@end quotation
address@hidden @command{gawk}, @code{RT} variable in
address@hidden @command{gawk} @subentry @code{RT} variable in
@cindex @code{RT} variable
address@hidden differences in @command{awk} and @command{gawk},
@code{RS}/@code{RT} variables
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{RS}/@code{RT} variables
The use of @code{RS} as a regular expression and the @code{RT}
variable are @command{gawk} extensions; they are not available in
compatibility mode
@@ -6597,7 +6597,7 @@ In compatibility mode, only the first character of the
value of
@code{RS} determines the end of the record.
@sidebar @code{RS = "\0"} Is Not Portable
address@hidden portability, data files as single record
address@hidden portability @subentry data files as single record
There are times when you might want to treat an entire @value{DF} as a
single record. The only way to make this happen is to give @code{RS}
a value that you know doesn't occur in the input file. This is hard
@@ -6612,7 +6612,7 @@ value to use for @code{RS} in this case:
BEGIN @{ RS = "\0" @} # whole file becomes one record?
@end example
address@hidden differences in @command{awk} and @command{gawk}, strings, storing
address@hidden differences in @command{awk} and @command{gawk} @subentry
strings @subentry storing
@command{gawk} in fact accepts this, and uses the @sc{nul}
character for the record separator.
This works for certain special files, such as @file{/proc/environ} on
@@ -6620,7 +6620,7 @@ GNU/Linux systems, where the @sc{nul} character is in
fact the record separator.
However, this usage is @emph{not} portable
to most other @command{awk} implementations.
address@hidden dark corner, strings, storing
address@hidden dark corner @subentry strings @subentry storing
Almost all other @command{awk} address@hidden least that we know
about.} store strings internally as C-style strings. C strings use the
@sc{nul} character as the string terminator. In effect, this means that
@@ -6632,7 +6632,7 @@ character as a record separator. However, this is a
special case:
@command{mawk} does not allow embedded @sc{nul} characters in strings.
(This may change in a future version of @command{mawk}.)
address@hidden records, treating files as
address@hidden records @subentry treating files as
@cindex treating files, as single records
@cindex single records, treating files as
@xref{Readfile Function} for an interesting way to read
@@ -6646,7 +6646,7 @@ Readfile} for another option.
@cindex examining fields
@cindex fields
@cindex accessing fields
address@hidden fields, examining
address@hidden fields @subentry examining
When @command{awk} reads an input record, the record is
automatically @dfn{parsed} or separated by the @command{awk} utility into
chunks
called @dfn{fields}. By default, fields are separated by @dfn{whitespace},
@@ -6663,8 +6663,8 @@ operate on the whole record if you want---but fields are
what make
simple @command{awk} programs so powerful.
@cindex field operator @code{$}
address@hidden @code{$} (dollar sign), @code{$} field operator
address@hidden dollar sign (@code{$}), @code{$} field operator
address@hidden @code{$} (dollar sign) @subentry @code{$} field operator
address@hidden dollar sign (@code{$}) @subentry @code{$} field operator
@cindex field address@hidden dollar sign as
You use a dollar sign (@samp{$})
to refer to a field in an @command{awk} program,
@@ -6686,7 +6686,7 @@ Here the first field, or @code{$1}, is @samp{This}, the
second field, or
field.
@cindex @code{NF} variable
address@hidden fields, number of
address@hidden fields @subentry number of
@code{NF} is a predefined variable whose value is the number of fields
in the current record. @command{awk} automatically updates the value
of @code{NF} each time it reads a record. No matter how many fields
@@ -6725,7 +6725,7 @@ $ @kbd{awk '/li/ @{ print $1, $NF @}' mail-list}
@node Nonconstant Fields
@section Nonconstant Field Numbers
address@hidden fields, numbers
address@hidden fields @subentry numbers
@cindex field numbers
A field number need not be a constant. Any expression in
@@ -6782,7 +6782,7 @@ evaluating @code{NF} and using its value as a field
number.
@node Changing Fields
@section Changing the Contents of a Field
address@hidden fields, changing contents of
address@hidden fields @subentry changing contents of
The contents of a field, as seen by @command{awk}, can be changed within an
@command{awk} program; this changes what @command{awk} perceives as the
current input record. (The actual input is untouched; @command{awk}
@emph{never}
@@ -6842,8 +6842,8 @@ $ @kbd{awk '@{ $6 = ($5 + $4 + $3 + $2)}
@dots{}
@end example
address@hidden adding, fields
address@hidden fields, adding
address@hidden adding @subentry fields
address@hidden fields @subentry adding
@noindent
We've just created @code{$6}, whose value is the sum of fields
@code{$2}, @code{$3}, @code{$4}, and @code{$5}. The @samp{+} sign
@@ -6915,7 +6915,7 @@ The intervening field, @code{$5}, is created with an
empty value
(indicated by the second pair of adjacent colons),
and @code{NF} is updated with the value six.
address@hidden dark corner, @code{NF} variable, decrementing
address@hidden dark corner @subentry @code{NF} variable @subentry decrementing
@cindex @code{NF} variable, decrementing
Decrementing @code{NF} throws away the values of the fields
after the new value of @code{NF} and recomputes @code{$0}.
@@ -6929,7 +6929,7 @@ $ @kbd{echo a b c d e f | awk '@{ print "NF =", NF;}
@print{} a b c
@end example
address@hidden portability, @code{NF} address@hidden decrementing
address@hidden portability @subentry @code{NF} variable, decrementing
@quotation CAUTION
Some versions of @command{awk} don't
rebuild @code{$0} when @code{NF} is decremented.
@@ -6991,9 +6991,9 @@ with a statement such as @samp{$1 = $1}, as described
earlier.
@end menu
@cindex @code{FS} variable
address@hidden fields, separating
address@hidden fields @subentry separating
@cindex field separators
address@hidden fields, separating
address@hidden fields @subentry separating
The @dfn{field separator}, which is either a single character or a regular
expression, controls the way @command{awk} splits an input record into fields.
@command{awk} scans the input record for character sequences that
@@ -7012,13 +7012,13 @@ is split into three fields: @samp{m}, @address@hidden,
and
@address@hidden@bullet{}pan}.
Note the leading spaces in the values of the second and third fields.
address@hidden troubleshooting, @command{awk} uses @code{FS} not @code{IFS}
address@hidden troubleshooting @subentry @command{awk} uses @code{FS} not
@code{IFS}
The field separator is represented by the predefined variable @code{FS}.
Shell programmers take note: @command{awk} does @emph{not} use the
name @code{IFS} that is used by the POSIX-compliant shells (such as
the Unix Bourne shell, @command{sh}, or Bash).
address@hidden @code{FS} variable, changing value of
address@hidden @code{FS} variable @subentry changing value of
The value of @code{FS} can be changed in the @command{awk} program with the
assignment operator, @samp{=} (@pxref{Assignment Ops}).
Often, the right time to do this is at the beginning of execution
@@ -7045,9 +7045,9 @@ John Q. Smith, 29 Oak St., Walamazoo, MI 42139
this @command{awk} program extracts and prints the string
@address@hidden@address@hidden
address@hidden field separators, choice of
address@hidden regular expressions, as field separators
address@hidden field separators, regular expressions as
address@hidden field separators @subentry choice of
address@hidden regular expressions @subentry as field separators
address@hidden field separators @subentry regular expressions as
Sometimes the input data contains separator characters that don't
separate fields the way you thought they would. For instance, the
person's name in the example we just used might have a title or
@@ -7070,8 +7070,8 @@ can massage it first with a separate @command{awk}
program.)
@node Default Field Splitting
@subsection Whitespace Normally Separates Fields
address@hidden field separators, whitespace as
address@hidden whitespace, as field separators
address@hidden field separators @subentry whitespace as
address@hidden whitespace @subentry as field separators
Fields are normally separated by whitespace sequences
(spaces, TABs, and newlines), not by single spaces. Two spaces in a row do not
delimit an empty field. The default value of the field separator @code{FS}
@@ -7092,8 +7092,8 @@ rules.
@node Regexp Field Splitting
@subsection Using Regular Expressions to Separate Fields
address@hidden regular expressions, as field separators
address@hidden field separators, regular expressions as
address@hidden regular expressions @subentry as field separators
address@hidden field separators @subentry regular expressions as
The previous @value{SUBSECTION}
discussed the use of single characters or simple strings as the
value of @code{FS}.
@@ -7148,7 +7148,7 @@ $ @kbd{echo ' a b c d ' | awk 'BEGIN @{ FS = "[
\t\n]+" @}}
@noindent
@cindex null strings
address@hidden strings, null
address@hidden strings @subentry null
@cindex empty strings @seeentry{null strings}
In this case, the first field is null, or empty.
@@ -7170,9 +7170,9 @@ Because the leading whitespace was ignored when finding
@code{$1},
it is not part of the new @code{$0}. Finally, the last @code{print}
statement prints the new @code{$0}.
address@hidden @code{FS}, containing @code{^}
address@hidden @code{^} (caret), in @code{FS}
address@hidden dark corner, @code{^}, in @code{FS}
address@hidden @code{FS} @subentry containing @code{^}
address@hidden @code{^} (caret) @subentry in @code{FS}
address@hidden dark corner @subentry @code{^} @subentry in @code{FS}
There is an additional subtlety to be aware of when using regular expressions
for field splitting.
It is not well specified in the POSIX standard, or anywhere else, what @samp{^}
@@ -7200,11 +7200,11 @@ $ @kbd{echo 'xxAA xxBxx C' |}
@node Single Character Fields
@subsection Making Each Character a Separate Field
address@hidden common extensions, single character fields
address@hidden extensions, address@hidden single character fields
address@hidden differences in @command{awk} and @command{gawk},
single-character fields
address@hidden common extensions @subentry single character fields
address@hidden extensions @subentry common, single character fields
address@hidden differences in @command{awk} and @command{gawk} @subentry
single-character fields
@cindex single-character fields
address@hidden fields, single-character
address@hidden fields @subentry single-character
There are times when you may want to examine each character
of a record separately. This can be done in @command{gawk} by
simply assigning the null string (@code{""}) to @code{FS}. @value{COMMONEXT}
@@ -7223,8 +7223,8 @@ $ @kbd{echo a b | gawk 'BEGIN @{ FS = "" @}}
@print{} Field 3 is b
@end example
address@hidden dark corner, @code{FS} as null string
address@hidden @code{FS} variable, as null string
address@hidden dark corner @subentry @code{FS} as null string
address@hidden @code{FS} variable @subentry as null string
Traditionally, the behavior of @code{FS} equal to @code{""} was not defined.
In this case, most versions of Unix @command{awk} simply treat the entire
record
as only having one field.
@@ -7236,10 +7236,10 @@ behaves this way.
@node Command Line Field Separator
@subsection Setting @code{FS} from the Command Line
address@hidden @option{-F} option, command-line
address@hidden field separator, on command line
address@hidden command line, @code{FS} address@hidden setting
address@hidden @code{FS} variable, setting from command line
address@hidden @option{-F} option @subentry command-line
address@hidden field separator @subentry on command line
address@hidden command line @subentry @code{FS} on, setting
address@hidden @code{FS} variable @subentry setting from command line
@code{FS} can be set on the command line. Use the @option{-F} option to
do so. For example:
@@ -7265,9 +7265,9 @@ awk -F\\\\ '@dots{}' files @dots{}
@end example
@noindent
address@hidden field separator, backslash (@code{\}) as
address@hidden @code{\} (backslash), as field separator
address@hidden backslash (@code{\}), as field separator
address@hidden field separator @subentry backslash (@code{\}) as
address@hidden @code{\} (backslash) @subentry as field separator
address@hidden backslash (@code{\}) @subentry as field separator
Because @samp{\} is used for quoting in the shell, @command{awk} sees
@samp{-F\\}. Then @command{awk} processes the @samp{\\} for escape
characters (@pxref{Escape Sequences}), finally yielding
@@ -7317,7 +7317,7 @@ separator, instead of the @samp{-} in the phone number
that was
originally intended. This demonstrates why you have to be careful in
choosing your field and record separators.
address@hidden Unix @command{awk}, password address@hidden field separators and
address@hidden Unix @command{awk} @subentry password files, field separators and
Perhaps the most common use of a single character as the field separator
occurs when processing the Unix system password file. On many Unix
systems, each user has a separate entry in the system password file, with one
@@ -7356,15 +7356,15 @@ When you do this, @code{$1} is the same as @code{$0}.
@sidebar Changing @code{FS} Does Not Affect the Fields
address@hidden POSIX @command{awk}, field separators and
address@hidden field separator, POSIX and
address@hidden POSIX @command{awk} @subentry field separators and
address@hidden field separator @subentry POSIX and
According to the POSIX standard, @command{awk} is supposed to behave
as if each record is split into fields at the time it is read.
In particular, this means that if you change the value of @code{FS}
after a record is read, the values of the fields (i.e., how they were split)
should reflect the old value of @code{FS}, not the new one.
address@hidden dark corner, field separators
address@hidden dark corner @subentry field separators
@cindex @command{sed} utility
@cindex stream editors
However, many older implementations of @command{awk} do not work this way.
Instead,
@@ -7464,7 +7464,7 @@ will take effect.
@cindex data, fixed-width
@cindex fixed-width data
address@hidden advanced features, fixed-width data
address@hidden advanced features @subentry fixed-width data
@c O'Reilly doesn't like it as a note the first thing in the section.
This @value{SECTION} discusses an advanced
@@ -7497,10 +7497,10 @@ on @code{FS} does not work well in this case. Although
a portable
@code{$0} (@pxref{String Functions}), this is awkward and inefficient
for a large number of fields.
address@hidden troubleshooting, fatal errors, field address@hidden specifying
address@hidden troubleshooting @subentry fatal errors @subentry field widths,
specifying
@cindex @command{w} utility
@cindex @code{FIELDWIDTHS} variable
address@hidden @command{gawk}, @code{FIELDWIDTHS} variable in
address@hidden @command{gawk} @subentry @code{FIELDWIDTHS} variable in
The splitting of an input record into fixed-width fields is specified by
assigning a string containing space-separated numbers to the built-in
variable @code{FIELDWIDTHS}. Each number specifies the width of the
@@ -7670,7 +7670,7 @@ This @value{SECTION} discusses an advanced
feature of @command{gawk}. If you are a novice @command{awk} user,
you might want to skip it on the first reading.
address@hidden advanced features, specifying field content
address@hidden advanced features @subentry specifying field content
Normally, when using @code{FS}, @command{gawk} defines the fields as the
parts of the record that occur in between each field separator. In other
words, @code{FS} defines what a field @emph{is not}, instead of what a field
@@ -7696,7 +7696,7 @@ Robbins,Arnold,"1234 A Pretty Street,
NE",MyTown,MyState,12345-6789,USA
@c endfile
@end example
address@hidden @command{gawk}, @code{FPAT} variable in
address@hidden @command{gawk} @subentry @code{FPAT} variable in
@cindex @code{FPAT} variable
The @code{FPAT} variable offers a solution for cases like this.
The value of @code{FPAT} should be a string that provides a regular expression.
@@ -7794,7 +7794,7 @@ available for splitting regular strings (@pxref{String
Functions}).
@node Testing field creation
@section Checking How @command{gawk} Is Splitting Records
address@hidden @command{gawk}, splitting fields and
address@hidden @command{gawk} @subentry splitting fields and
As we've seen, @command{gawk} provides three independent methods to split
input records into fields. The mechanism used is based on which of the
three address@hidden, @code{FIELDWIDTHS}, or @code{FPAT}---was
@@ -7833,15 +7833,15 @@ example of such a function).
@section Multiple-Line Records
@cindex multiple-line records
address@hidden records, multiline
address@hidden input, multiline records
address@hidden files, reading, multiline records
address@hidden records @subentry multiline
address@hidden input @subentry multiline records
address@hidden files @subentry reading @subentry multiline records
@cindex input, files @seeentry{input files}
In some databases, a single line cannot conveniently hold all the
information in one entry. In such cases, you can use multiline
records. The first step in doing this is to choose your data format.
address@hidden record separators, with multiline records
address@hidden record separators @subentry with multiline records
One technique is to use an unusual character or string to separate
records. For example, you could use the formfeed character (written
@samp{\f} in @command{awk}, as in C) to separate them, making each record
@@ -7862,7 +7862,7 @@ all act as one record separator.
whitespace do not count.)
@cindex leftmost longest match
address@hidden matching, leftmost longest
address@hidden matching @subentry leftmost longest
You can achieve the same effect as @samp{RS = ""} by assigning the
string @code{"\n\n+"} to @code{RS}. This regexp matches the newline
at the end of the record and one or more blank lines after the record.
@@ -7873,7 +7873,7 @@ So, the next record doesn't start until
the first nonblank line that follows---no matter how many blank lines
appear in a row, they are considered one record separator.
address@hidden dark corner, multiline records
address@hidden dark corner @subentry multiline records
However, there is an important difference between @samp{RS = ""} and
@samp{RS = "\n\n+"}. In the first case, leading newlines in the input
@value{DF} are ignored, and if a file ends without extra blank lines
@@ -7881,8 +7881,8 @@ after the last record, the final newline is removed from
the record.
In the second case, this special processing is not done.
@value{DARKCORNER}
address@hidden field separator, in multiline records
address@hidden @code{FS}, in multiline records
address@hidden field separator @subentry in multiline records
address@hidden @code{FS} @subentry in multiline records
Now that the input is separated into records, the second step is to
separate the fields in the records. One way to do this is to divide each
of the lines into fields in the normal manner. This happens by default
@@ -7995,9 +7995,9 @@ Leading and trailing matches of @var{regexp} delimit
empty records.
POSIX standard.)
@end table
address@hidden @command{gawk}, @code{RT} variable in
address@hidden @command{gawk} @subentry @code{RT} variable in
@cindex @code{RT} variable
address@hidden differences in @command{awk} and @command{gawk},
@code{RS}/@code{RT} variables
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{RS}/@code{RT} variables
If not in compatibility mode (@pxref{Options}), @command{gawk} sets
@code{RT} to the input text that matched the value specified by @code{RS}.
But if the input file ended without any text that matches @code{RS},
@@ -8006,8 +8006,8 @@ then @command{gawk} sets @code{RT} to the null string.
@node Getline
@section Explicit Input with @code{getline}
address@hidden @code{getline} command, explicit input with
address@hidden input, explicit
address@hidden @code{getline} command @subentry explicit input with
address@hidden input @subentry explicit
So far we have been getting our input data from @command{awk}'s main
input stream---either the standard input (usually your keyboard, sometimes
the output from another program) or the
@@ -8034,11 +8034,11 @@ Parts I and II
@end ifnotinfo
and have a good knowledge of how @command{awk} works.
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @code{ERRNO} variable, with @command{getline} command
address@hidden differences in @command{awk} and @command{gawk}, @code{getline}
command
address@hidden @code{getline} command, return values
address@hidden @option{--sandbox} option, input redirection with @code{getline}
address@hidden @command{gawk} @subentry @code{ERRNO} variable in
address@hidden @code{ERRNO} variable @subentry with @command{getline} command
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{getline} command
address@hidden @code{getline} command @subentry return values
address@hidden @option{--sandbox} option @subentry input redirection with
@code{getline}
The @code{getline} command returns 1 if it finds a record and 0 if
it encounters the end of the file. If there is some error in getting
@@ -8158,7 +8158,7 @@ rule in the program. @xref{Next Statement}.
@node Getline/Variable
@subsection Using @code{getline} into a Variable
@cindex @code{getline} into a variable
address@hidden variables, @code{getline} command address@hidden using
address@hidden variables @subentry @code{getline} command into, using
You can use @samp{getline @var{var}} to read the next record from
@command{awk}'s input into the variable @var{var}. No other processing is
@@ -8214,9 +8214,9 @@ the value of @code{NF} do not change.
@cindex @code{getline} from a file
@cindex input redirection
@cindex redirection of input
address@hidden @code{<} (left angle bracket), @code{<} operator (I/O)
address@hidden left angle bracket (@code{<}), @code{<} operator (I/O)
address@hidden operators, input/output
address@hidden @code{<} (left angle bracket) @subentry @code{<} operator (I/O)
address@hidden left angle bracket (@code{<}) @subentry @code{<} operator (I/O)
address@hidden operators @subentry input/output
Use @samp{getline < @var{file}} to read the next record from @var{file}.
Here, @var{file} is a string-valued expression that
specifies the @value{FN}. @samp{< @var{file}} is called a @dfn{redirection}
@@ -8242,7 +8242,7 @@ the normal manner, so the values of @code{$0} and the
other fields are
changed, resulting in a new value of @code{NF}.
@code{RT} is also set.
address@hidden POSIX @command{awk}, @code{<} operator and
address@hidden POSIX @command{awk} @subentry @code{<} operator and
@c Thanks to Paul Eggert for initial wording here
According to POSIX, @samp{getline < @var{expression}} is ambiguous if
@var{expression} contains unparenthesized operators other than
@@ -8253,7 +8253,7 @@ you want your program to be portable to all @command{awk}
implementations.
@node Getline/Variable/File
@subsection Using @code{getline} into a Variable from a File
address@hidden variables, @code{getline} command address@hidden using
address@hidden variables @subentry @code{getline} command into, using
Use @samp{getline @var{var} < @var{file}} to read input
from the file
@@ -8307,11 +8307,11 @@ Failing that, attention to details would be useful.}
@author Brian Kernighan
@end quotation
address@hidden @code{|} (vertical bar), @code{|} operator (I/O)
address@hidden vertical bar (@code{|}), @code{|} operator (I/O)
address@hidden @code{|} (vertical bar) @subentry @code{|} operator (I/O)
address@hidden vertical bar (@code{|}) @subentry @code{|} operator (I/O)
@cindex input pipeline
address@hidden pipe, input
address@hidden operators, input/output
address@hidden pipe @subentry input
address@hidden operators @subentry input/output
The output of a command can also be piped into @code{getline}, using
@address@hidden | getline}. In
this case, the string @var{command} is run as a shell command and its output
@@ -8381,7 +8381,7 @@ value of @code{NF}, and recomputes the value of
@code{$0}. The values of
@code{NR} and @code{FNR} are not changed.
@code{RT} is set.
address@hidden POSIX @command{awk}, @code{|} I/O operator and
address@hidden POSIX @command{awk} @subentry @code{|} I/O operator and
@c Thanks to Paul Eggert for initial wording here
According to POSIX, @address@hidden | getline} is ambiguous if
@var{expression} contains unparenthesized operators other than
@@ -8407,7 +8407,7 @@ have to worry.
@node Getline/Variable/Pipe
@subsection Using @code{getline} into a Variable from a Pipe
address@hidden variables, @code{getline} command address@hidden using
address@hidden variables @subentry @code{getline} command into, using
When you use @address@hidden | getline @var{var}}, the
output of @var{command} is sent through a pipe to
@@ -8439,12 +8439,12 @@ program to be portable to other @command{awk}
implementations.
@node Getline/Coprocess
@subsection Using @code{getline} from a Coprocess
address@hidden coprocesses, @code{getline} from
address@hidden @code{getline} command, address@hidden using from
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}), @code{|&} operator (I/O)
address@hidden operators, input/output
address@hidden differences in @command{awk} and @command{gawk}, input/output
operators
address@hidden coprocesses @subentry @code{getline} from
address@hidden @code{getline} command @subentry coprocesses, using from
address@hidden @code{|} (vertical bar) @subentry @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}) @subentry @code{|&} operator (I/O)
address@hidden operators @subentry input/output
address@hidden differences in @command{awk} and @command{gawk} @subentry
input/output operators
Reading input into @code{getline} from a pipe is a one-way operation.
The command that is started with @address@hidden | getline} only
@@ -8480,7 +8480,7 @@ where coprocesses are discussed in more detail.
@node Getline/Variable/Coprocess
@subsection Using @code{getline} into a Variable from a Coprocess
address@hidden variables, @code{getline} command address@hidden using
address@hidden variables @subentry @code{getline} command into, using
When you use @address@hidden |& getline @var{var}}, the output from
the coprocess @var{command} is sent through a two-way pipe to @code{getline}
@@ -8510,21 +8510,21 @@ When @code{getline} changes the value of @code{$0} and
@code{NF},
program and start testing the new record against every pattern.
However, the new record is tested against any subsequent rules.
address@hidden differences in @command{awk} and @command{gawk}, implementation
limitations
address@hidden implementation issues, @command{gawk}, limits
address@hidden @command{awk}, implementations, limits
address@hidden @command{gawk}, implementation issues, limits
address@hidden differences in @command{awk} and @command{gawk} @subentry
implementation limitations
address@hidden implementation issues @subentry @command{gawk} @subentry limits
address@hidden @command{awk} @subentry implementations @subentry limits
address@hidden @command{gawk} @subentry implementation issues @subentry limits
@item
Some very old @command{awk} implementations limit the number of pipelines that
an @command{awk}
program may have open to just one. In @command{gawk}, there is no such limit.
You can open as many pipelines (and coprocesses) as the underlying operating
system permits.
address@hidden side effects, @code{FILENAME} variable
address@hidden side effects @subentry @code{FILENAME} variable
@cindex @code{FILENAME} variable, @address@hidden setting with
address@hidden dark corner, @code{FILENAME} variable
address@hidden @code{getline} command, @code{FILENAME} variable and
address@hidden @code{BEGIN} pattern, @code{getline} and
address@hidden dark corner @subentry @code{FILENAME} variable
address@hidden @code{getline} command @subentry @code{FILENAME} variable and
address@hidden @code{BEGIN} pattern @subentry @code{getline} and
@item
An interesting side effect occurs if you use @code{getline} without a
redirection inside a @code{BEGIN} rule. Because an unredirected @code{getline}
@@ -8591,7 +8591,7 @@ know that there is a string value to be assigned.
@node Getline Summary
@subsection Summary of @code{getline} Variants
address@hidden @code{getline} command, variants
address@hidden @code{getline} command @subentry variants
@ref{table-getline-variants}
summarizes the eight variants of @code{getline},
@@ -8618,7 +8618,7 @@ Note: for each variant, @command{gawk} sets the @code{RT}
predefined variable.
@section Reading Input with a Timeout
@cindex timeout, reading input
address@hidden differences in @command{awk} and @command{gawk}, read timeouts
address@hidden differences in @command{awk} and @command{gawk} @subentry read
timeouts
This @value{SECTION} describes a feature that is specific to @command{gawk}.
You may specify a timeout in milliseconds for reading input from the keyboard,
@@ -8728,7 +8728,7 @@ indefinitely until some other process opens it for
writing.
@section Retrying Reads After Certain Input Errors
@cindex retrying input
address@hidden differences in @command{awk} and @command{gawk}, retrying input
address@hidden differences in @command{awk} and @command{gawk} @subentry
retrying input
This @value{SECTION} describes a feature that is specific to @command{gawk}.
When @command{gawk} encounters an error while reading input, by
@@ -8756,9 +8756,9 @@ descriptor has been configured to behave in a
non-blocking fashion.
@node Command-line directories
@section Directories on the Command Line
address@hidden differences in @command{awk} and @command{gawk}, command-line
directories
address@hidden directories, command-line
address@hidden command line, directories on
address@hidden differences in @command{awk} and @command{gawk} @subentry
command-line directories
address@hidden directories @subentry command-line
address@hidden command line @subentry directories on
According to the POSIX standard, files named on the @command{awk}
command line must be text files; it is a fatal error if they are not.
@@ -8942,9 +8942,9 @@ The items to print can be constant strings or numbers,
fields of the
current record (such as @code{$1}), variables, or any @command{awk}
expression. Numeric values are converted to strings and then printed.
address@hidden records, printing
address@hidden lines, address@hidden printing
address@hidden text, printing
address@hidden records @subentry printing
address@hidden lines, blank, printing
address@hidden text @subentry printing
The simple statement @samp{print} with no items is equivalent to
@samp{print $0}: it prints the entire current record. To print a blank
line, use @samp{print ""}.
@@ -8966,7 +8966,7 @@ isn't limited to only one line. If an item value is a
string containing a
newline, the newline is output along with the rest of the string. A
single @code{print} statement can make any number of lines this way.
address@hidden newlines, printing
address@hidden newlines @subentry printing
The following is an example of printing a string that contains embedded
@ifinfo
newlines
@@ -8993,7 +8993,7 @@ $ @kbd{awk 'BEGIN @{ print "line one\nline two\nline
three" @}'}
@end group
@end example
address@hidden fields, printing
address@hidden fields @subentry printing
The next example, which is run on the @file{inventory-shipped} file,
prints the first two fields of each input record, with a space between
them:
@@ -9006,8 +9006,8 @@ $ @kbd{awk '@{ print $1, $2 @}' inventory-shipped}
@dots{}
@end example
address@hidden @code{print} statement, commas, omitting
address@hidden troubleshooting, @code{print} address@hidden omitting commas
address@hidden @code{print} statement @subentry commas @subentry omitting
address@hidden troubleshooting @subentry @code{print} statement, omitting commas
A common mistake in using the @code{print} statement is to omit the comma
between two items. This often has the effect of making the items run
together in the output, with no space. The reason for this is that
@@ -9022,7 +9022,7 @@ $ @kbd{awk '@{ print $1 $2 @}' inventory-shipped}
@dots{}
@end example
address@hidden @code{BEGIN} pattern, address@hidden adding
address@hidden @code{BEGIN} pattern @subentry headings, adding
To someone unfamiliar with the @file{inventory-shipped} file, neither
example's output makes much sense. A heading line at the beginning
would make it clearer. Let's add some headings to our table of months
@@ -9061,8 +9061,8 @@ awk 'BEGIN @{ print "Month Crates"
@end group
@end example
address@hidden @code{printf} statement, address@hidden aligning
address@hidden columns, aligning
address@hidden @code{printf} statement @subentry columns, aligning
address@hidden columns @subentry aligning
Lining up columns this way can get pretty
complicated when there are many columns to fix. Counting spaces for two
or three columns is simple, but any more than this can take up
@@ -9070,8 +9070,8 @@ a lot of time. This is why the @code{printf} statement was
created (@pxref{Printf});
one of its specialties is lining up columns of data.
address@hidden line continuations, in @code{print} statement
address@hidden @code{print} statement, line continuations and
address@hidden line continuations @subentry in @code{print} statement
address@hidden @code{print} statement @subentry line continuations and
@quotation NOTE
You can continue either a @code{print} or
@code{printf} statement simply by putting a newline after any comma
@@ -9097,10 +9097,10 @@ then outputs a string called the @dfn{output record
separator} (or
(i.e., a newline character). Thus, each @code{print} statement normally
makes a separate line.
address@hidden output, records
address@hidden output @subentry records
@cindex output record separator @address@hidden variable}
@cindex @code{ORS} variable
address@hidden @code{BEGIN} pattern, @code{OFS}/@code{ORS} variables, assigning
values to
address@hidden @code{BEGIN} pattern @subentry @code{OFS}/@code{ORS} variables
@subentry assigning values to
In order to change how output fields and records are separated, assign
new values to the variables @code{OFS} and @code{ORS}. The usual
place to do this is in the @code{BEGIN} rule
@@ -9146,7 +9146,7 @@ runs together on a single line.
@node OFMT
@section Controlling Numeric Output with @code{print}
address@hidden numeric, output format
address@hidden numeric @subentry output format
@cindex address@hidden numeric output
When printing numeric values with the @code{print} statement,
@command{awk} internally converts each number to a string of characters
@@ -9162,7 +9162,7 @@ more fully in
@cindexawkfunc{sprintf}
@cindex @code{OFMT} variable
address@hidden output, format address@hidden @code{OFMT}
address@hidden output @subentry format specifier, @code{OFMT}
The predefined variable @code{OFMT} contains the format specification
that @code{print} uses with @code{sprintf()} when it wants to convert a
number to a string for printing.
@@ -9179,8 +9179,8 @@ $ @kbd{awk 'BEGIN @{}
@end example
@noindent
address@hidden dark corner, @code{OFMT} variable
address@hidden POSIX @command{awk}, @code{OFMT} variable and
address@hidden dark corner @subentry @code{OFMT} variable
address@hidden POSIX @command{awk} @subentry @code{OFMT} variable and
@cindex @code{OFMT} variable, POSIX @command{awk} and
According to the POSIX standard, @command{awk}'s behavior is undefined
if @code{OFMT} contains anything but a floating-point conversion specification.
@@ -9190,7 +9190,7 @@ if @code{OFMT} contains anything but a floating-point
conversion specification.
@section Using @code{printf} Statements for Fancier Printing
@cindex @code{printf} statement
address@hidden output, formatted
address@hidden output @subentry formatted
@cindex formatting output
For more precise control over the output format than what is
provided by @code{print}, use @code{printf}.
@@ -9210,7 +9210,7 @@ after the decimal point).
@node Basic Printf
@subsection Introduction to the @code{printf} Statement
address@hidden @code{printf} statement, syntax of
address@hidden @code{printf} statement @subentry syntax of
A simple @code{printf} statement looks like this:
@example
@@ -9258,8 +9258,8 @@ the output message.
@node Control Letters
@subsection Format-Control Letters
address@hidden @code{printf} statement, format-control characters
address@hidden format specifiers, @code{printf} statement
address@hidden @code{printf} statement @subentry format-control characters
address@hidden format specifiers @subentry @code{printf} statement
A format specifier starts with the character @samp{%} and ends with
a @dfn{format-control letter}---it tells the @code{printf} statement
@@ -9294,8 +9294,8 @@ Print a number as a character; thus, @samp{printf "%c",
65} outputs the letter @samp{A}. The output for a string value is
the first character of the string.
address@hidden dark corner, format-control characters
address@hidden @command{gawk}, format-control characters
address@hidden dark corner @subentry format-control characters
address@hidden @command{gawk} @subentry format-control characters
@quotation NOTE
The POSIX standard says the first character of a string is printed.
In locales with multibyte characters, @command{gawk} attempts to
@@ -9393,8 +9393,8 @@ This does not consume an
argument and it ignores any modifiers.
@end table
address@hidden dark corner, format-control characters
address@hidden @command{gawk}, format-control characters
address@hidden dark corner @subentry format-control characters
address@hidden @command{gawk} @subentry format-control characters
@quotation NOTE
When using the integer format-control letters for values that are
outside the range of the widest C integer type, @command{gawk} switches to
@@ -9419,7 +9419,7 @@ the IEEE standard. Further details are provided in
@node Format Modifiers
@subsection Modifiers for @code{printf} Formats
address@hidden @code{printf} statement, modifiers
address@hidden @code{printf} statement @subentry modifiers
@cindex address@hidden in format specifiers
A format specification can also include @dfn{modifiers} that can control
how much of the item's value is printed, as well as how much space it gets.
@@ -9430,10 +9430,10 @@ spaces in the output. Here are the possible modifiers,
in the order in
which they may appear:
@table @asis
address@hidden differences in @command{awk} and @command{gawk},
@code{print}/@code{printf} statements
address@hidden @code{printf} statement, positional specifiers
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{print}/@code{printf} statements
address@hidden @code{printf} statement @subentry positional specifiers
@c the code{} does NOT start a secondary
address@hidden positional specifiers, @code{printf} statement
address@hidden positional specifiers @subentry @code{printf} statement
@item @address@hidden
An integer constant followed by a @samp{$} is a @dfn{positional specifier}.
Normally, format specifications are applied to arguments in the order
@@ -9616,8 +9616,8 @@ printf "%" w "." p "s\n", s
This is not particularly easy to read, but it does work.
@c @cindex lint checks
address@hidden troubleshooting, fatal errors, @code{printf} format strings
address@hidden POSIX @command{awk}, @code{printf} format strings and
address@hidden troubleshooting @subentry fatal errors @subentry @code{printf}
format strings
address@hidden POSIX @command{awk} @subentry @code{printf} format strings and
C programmers may be used to supplying additional modifiers (@samp{h},
@samp{j}, @samp{l}, @samp{L}, @samp{t}, and @samp{z}) in @code{printf}
format strings. These are not valid in @command{awk}. Most @command{awk}
@@ -9710,7 +9710,7 @@ awk 'BEGIN @{ format = "%-10s %s\n"
@cindex output redirection
@cindex redirection of output
address@hidden @option{--sandbox} option, output redirection with @code{print},
@code{printf}
address@hidden @option{--sandbox} option @subentry output redirection with
@code{print} @subentry @code{printf}
So far, the output from @code{print} and @code{printf} has gone
to the standard
output, usually the screen. Both @code{print} and @code{printf} can
@@ -9735,9 +9735,9 @@ to a coprocess. We show them all for the @code{print}
statement,
but they work identically for @code{printf}:
@table @code
address@hidden @code{>} (right angle bracket), @code{>} operator (I/O)
address@hidden right angle bracket (@code{>}), @code{>} operator (I/O)
address@hidden operators, input/output
address@hidden @code{>} (right angle bracket) @subentry @code{>} operator (I/O)
address@hidden right angle bracket (@code{>}) @subentry @code{>} operator (I/O)
address@hidden operators @subentry input/output
@item print @var{items} > @var{output-file}
This redirection prints the items into the output file named
@var{output-file}. The @value{FN} @var{output-file} can be any
@@ -9769,8 +9769,8 @@ $ @kbd{cat name-list}
@noindent
Each output file contains one name or number per line.
address@hidden @code{>} (right angle bracket), @code{>>} operator (I/O)
address@hidden right angle bracket (@code{>}), @code{>>} operator (I/O)
address@hidden @code{>} (right angle bracket) @subentry @code{>>} operator (I/O)
address@hidden right angle bracket (@code{>}) @subentry @code{>>} operator (I/O)
@item print @var{items} >> @var{output-file}
This redirection prints the items into the preexisting output file
named @var{output-file}. The difference between this and the
@@ -9779,9 +9779,9 @@ address@hidden>} redirection is that the old contents (if
any) of
appended to the file.
If @var{output-file} does not exist, then it is created.
address@hidden @code{|} (vertical bar), @code{|} operator (I/O)
address@hidden pipe, output
address@hidden output, pipes
address@hidden @code{|} (vertical bar) @subentry @code{|} operator (I/O)
address@hidden pipe @subentry output
address@hidden output @subentry pipes
@item print @var{items} | @var{command}
It is possible to send output to another program through a pipe
instead of into a file. This redirection opens a pipe to
@@ -9836,9 +9836,9 @@ because (if you mean to refer to that same file or
command)
every time.
@cindex coprocesses
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O)
address@hidden operators, input/output
address@hidden differences in @command{awk} and @command{gawk}, input/output
operators
address@hidden @code{|} (vertical bar) @subentry @code{|&} operator (I/O)
address@hidden operators @subentry input/output
address@hidden differences in @command{awk} and @command{gawk} @subentry
input/output operators
@item print @var{items} |& @var{command}
This redirection prints the items to the input of @var{command}.
The difference between this and the
@@ -9868,7 +9868,7 @@ asks the system to open a file, pipe, or coprocess only
if the particular
@var{file} or @var{command} you specify has not already been written
to by your program or if it has been closed since it was last written to.
address@hidden troubleshooting, printing
address@hidden troubleshooting @subentry printing
It is a common error to use @samp{>} redirection for the first @code{print}
to a file, and then to use @samp{>>} for subsequent output:
@@ -9889,10 +9889,10 @@ output is produced in the expected order. However,
mixing the operators
for the same file is definitely poor style, and is confusing to readers
of your program.)
address@hidden differences in @command{awk} and @command{gawk}, implementation
limitations
address@hidden implementation issues, @command{gawk}, limits
address@hidden @command{awk}, implementation issues, pipes
address@hidden @command{gawk}, implementation issues, pipes
address@hidden differences in @command{awk} and @command{gawk} @subentry
implementation limitations
address@hidden implementation issues @subentry @command{gawk} @subentry limits
address@hidden @command{awk} @subentry implementation issues @subentry pipes
address@hidden @command{gawk} @subentry implementation issues @subentry pipes
@ifnotinfo
As mentioned earlier
(@pxref{Getline Notes}),
@@ -9910,7 +9910,7 @@ program may have open to just one! In @command{gawk},
there is no such limit.
open as many pipelines as the underlying operating system permits.
@sidebar Piping into @command{sh}
address@hidden shells, piping commands into
address@hidden shells @subentry piping commands into
A particularly powerful way to use redirection is to build command lines
and pipe them into the shell, @command{sh}. For example, suppose you
@@ -9939,9 +9939,9 @@ command lines to be fed to the shell.
@node Special FD
@section Special Files for Standard Preopened Data Streams
@cindex standard input
address@hidden input, standard
address@hidden input @subentry standard
@cindex standard output
address@hidden output, standard
address@hidden output @subentry standard
@cindex error output
@cindex standard error
@cindex file descriptors
@@ -9960,7 +9960,7 @@ is typically used for writing error messages; the reason
there are two separate
streams, standard output and standard error, is so that they can be
redirected separately.
address@hidden differences in @command{awk} and @command{gawk}, error messages
address@hidden differences in @command{awk} and @command{gawk} @subentry error
messages
@cindex error handling
In traditional implementations of @command{awk}, the only way to write an error
message to standard error in an @command{awk} program is as follows:
@@ -10003,15 +10003,15 @@ the descriptor that the @value{FN} stands for. These
special
@value{FN}s work for all operating systems that @command{gawk}
has been ported to, not just those that are POSIX-compliant:
address@hidden common extensions, @code{/dev/stdin} special file
address@hidden common extensions, @code{/dev/stdout} special file
address@hidden common extensions, @code{/dev/stderr} special file
address@hidden extensions, address@hidden @code{/dev/stdin} special file
address@hidden extensions, address@hidden @code{/dev/stdout} special file
address@hidden extensions, address@hidden @code{/dev/stderr} special file
address@hidden file names, standard streams in @command{gawk}
address@hidden common extensions @subentry @code{/dev/stdin} special file
address@hidden common extensions @subentry @code{/dev/stdout} special file
address@hidden common extensions @subentry @code{/dev/stderr} special file
address@hidden extensions @subentry common, @code{/dev/stdin} special file
address@hidden extensions @subentry common, @code{/dev/stdout} special file
address@hidden extensions @subentry common, @code{/dev/stderr} special file
address@hidden file names @subentry standard streams in @command{gawk}
@cindex @code{/dev/@dots{}} special files
address@hidden files, @code{/dev/@dots{}} special files
address@hidden files @subentry @code{/dev/@dots{}} special files
@cindex @code{/dev/fd/@var{N}} special files (@command{gawk})
@table @file
@item /dev/stdin
@@ -10031,7 +10031,7 @@ the proper way to write an error message then becomes:
print "Serious error detected!" > "/dev/stderr"
@end example
address@hidden troubleshooting, quotes with file names
address@hidden troubleshooting @subentry quotes with file names
Note the use of quotes around the @value{FN}.
Like with any other redirection, the value must be a string.
It is a common error to omit the quotes, which leads
@@ -10044,7 +10044,7 @@ invoked with the @option{--traditional} option
(@pxref{Options}).
@node Special Files
@section Special @value{FFN}s in @command{gawk}
address@hidden @command{gawk}, file names in
address@hidden @command{gawk} @subentry file names in
Besides access to standard input, standard output, and standard error,
@command{gawk} provides access to any open file descriptor.
@@ -10083,7 +10083,7 @@ above two, does actually close the given file
descriptor.
@node Special Network
@subsection Special Files for Network Communications
address@hidden networks, support for
address@hidden networks @subentry support for
@cindex TCP/IP, support for
@command{gawk} programs
@@ -10113,8 +10113,8 @@ Here are some things to bear in mind when using the
special @value{FN}s that @command{gawk} provides:
@itemize @value{BULLET}
address@hidden compatibility mode (@command{gawk}), file names
address@hidden file names, in compatibility mode
address@hidden compatibility mode (@command{gawk}) @subentry file names
address@hidden file names @subentry in compatibility mode
@item
Recognition of the @value{FN}s for the three standard preopened
files is disabled only in POSIX mode.
@@ -10138,11 +10138,11 @@ Doing so results in unpredictable behavior.
@node Close Files And Pipes
@section Closing Input and Output Redirections
@cindex files, output @seeentry{output files}
address@hidden input files, closing
address@hidden output, address@hidden closing
address@hidden pipe, closing
address@hidden coprocesses, closing
address@hidden @code{getline} command, address@hidden using from
address@hidden input files @subentry closing
address@hidden output @subentry files, closing
address@hidden pipe @subentry closing
address@hidden coprocesses @subentry closing
address@hidden @code{getline} command @subentry coprocesses, using from
If the same @value{FN} or the same shell command is used with @code{getline}
more than once during the execution of an @command{awk} program
@@ -10244,9 +10244,9 @@ program closes the pipe after each line of output, then
each line makes
a separate message.
@end itemize
address@hidden differences in @command{awk} and @command{gawk}, @code{close()}
function
address@hidden portability, @code{close()} function and
address@hidden @code{close()} function, portability
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{close()} function
address@hidden portability @subentry @code{close()} function and
address@hidden @code{close()} function @subentry portability
If you use more files than the system allows you to have open,
@command{gawk} attempts to multiplex the available open files among
your @value{DF}s. @command{gawk}'s ability to do this depends upon the
@@ -10294,7 +10294,7 @@ It is, more likely, a close of a file that was never
opened with a
redirection, so @command{awk} silently does nothing, except return
a negative value.
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O),
address@hidden closing
address@hidden @code{|} (vertical bar) @subentry @code{|&} operator (I/O)
@subentry pipes, closing
When using the @samp{|&} operator to communicate with a coprocess,
it is occasionally useful to be able to close one end of the two-way
pipe without closing the other.
@@ -10310,11 +10310,11 @@ delayed until
which describes it in more detail and gives an example.
@sidebar Using @code{close()}'s Return Value
address@hidden dark corner, @code{close()} function
address@hidden @code{close()} function, return value
address@hidden dark corner @subentry @code{close()} function
address@hidden @code{close()} function @subentry return value
@cindex return address@hidden @code{close()} function
address@hidden differences in @command{awk} and @command{gawk}, @code{close()}
function
address@hidden Unix @command{awk}, @code{close()} function and
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{close()} function
address@hidden Unix @command{awk} @subentry @code{close()} function and
In many older versions of Unix @command{awk}, the @code{close()} function
is actually a statement.
@@ -10328,8 +10328,8 @@ command | getline info
retval = close(command) # syntax error in many Unix awks
@end example
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @code{ERRNO} variable, with @command{close()} function
address@hidden @command{gawk} @subentry @code{ERRNO} variable in
address@hidden @code{ERRNO} variable @subentry with @command{close()} function
@command{gawk} treats @code{close()} as a function.
The return value is @minus{}1 if the argument names something
that was never opened with a redirection, or if there is
@@ -10546,7 +10546,7 @@ that provide the values used in expressions.
@node Constants
@subsection Constant Expressions
address@hidden constants, types of
address@hidden constants @subentry types of
The simplest type of expression is the @dfn{constant}, which always has
the same value. There are three types of constants: numeric,
@@ -10565,7 +10565,7 @@ have different forms, but are internally stored in an
identical manner.
@node Scalar Constants
@subsubsection Numeric and String Constants
address@hidden constants, numeric
address@hidden constants @subentry numeric
@cindex numeric constants
A @dfn{numeric constant} stands for a number. This number can be an
integer, a decimal fraction, or a number in scientific (exponential)
@@ -10591,8 +10591,8 @@ double quotation marks. For example:
@end example
@noindent
address@hidden differences in @command{awk} and @command{gawk}, strings
address@hidden strings, length limitations
address@hidden differences in @command{awk} and @command{gawk} @subentry strings
address@hidden strings @subentry length limitations
represents the string whose contents are @samp{parrot}. Strings in
@command{gawk} can be of any length, and they can contain any of the possible
eight-bit ASCII characters, including ASCII @sc{nul} (character code zero).
@@ -10631,9 +10631,9 @@ $ @kbd{gawk 'BEGIN @{ print "hello, }
@print{} gawk: cmd. line:1: ^ syntax error
@end example
address@hidden dark corner, string continuation
address@hidden strings, continuation across lines
address@hidden differences in @command{awk} and @command{gawk}, strings
address@hidden dark corner @subentry string continuation
address@hidden strings @subentry continuation across lines
address@hidden differences in @command{awk} and @command{gawk} @subentry strings
Although POSIX doesn't define what happens if you use an escaped
newline, as in the previous C example, all known versions of
@command{awk} allow you to do so. Unfortunately, what each one
@@ -10665,8 +10665,8 @@ $ @kbd{nawk 'BEGIN @{ print "hello, \}
@subsubsection Octal and Hexadecimal Numbers
@cindex octal numbers
@cindex hexadecimal numbers
address@hidden numbers, octal
address@hidden numbers, hexadecimal
address@hidden numbers @subentry octal
address@hidden numbers @subentry hexadecimal
In @command{awk}, all numbers are in decimal (i.e., base 10). Many other
programming languages allow you to specify numbers in other bases, often
@@ -10711,8 +10711,8 @@ Being able to use octal and hexadecimal constants in
your programs is most
useful when working with data that cannot be represented conveniently as
characters or as regular numbers, such as binary data of various sorts.
address@hidden @command{gawk}, octal numbers and
address@hidden @command{gawk}, hexadecimal numbers and
address@hidden @command{gawk} @subentry octal numbers and
address@hidden @command{gawk} @subentry hexadecimal numbers and
@command{gawk} allows the use of octal and hexadecimal
constants in your program text. However, such numbers in the input data
are not treated differently; doing so by default would break old
@@ -10739,8 +10739,8 @@ $ @kbd{gawk 'BEGIN @{ print "021 is", 021 ; print 018
@}'}
@print{} 18
@end example
address@hidden compatibility mode (@command{gawk}), octal numbers
address@hidden compatibility mode (@command{gawk}), hexadecimal numbers
address@hidden compatibility mode (@command{gawk}) @subentry octal numbers
address@hidden compatibility mode (@command{gawk}) @subentry hexadecimal numbers
Octal and hexadecimal source code constants are a @command{gawk} extension.
If @command{gawk} is in compatibility mode
(@pxref{Options}),
@@ -10765,10 +10765,10 @@ $ @kbd{gawk 'BEGIN @{ printf "0x11 is <%s>\n", 0x11
@}'}
@subsubsection Regular Expression Constants
@cindex regexp constants
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
A @dfn{regexp constant} is a regular expression description enclosed in
slashes, such as @address@hidden/^beginning and end$/}}. Most regexps used in
@command{awk} programs are constant, but the @samp{~} and @samp{!~}
@@ -10793,7 +10793,7 @@ POSIX @command{awk} and @command{gawk}, and then goes
on to describe
@node Standard Regexp Constants
@subsubsection Standard Regular Expression Constants
address@hidden dark corner, regexp constants
address@hidden dark corner @subentry regexp constants
When used on the righthand side of the @samp{~} or @samp{!~}
operators, a regexp constant merely stands for the regexp that is to be
matched.
@@ -10831,8 +10831,8 @@ if (/foo/ ~ $1) print "found foo"
@c @cindex automatic warnings
@c @cindex warnings, automatic
address@hidden @command{gawk}, regexp constants and
address@hidden regexp constants, in @command{gawk}
address@hidden @command{gawk} @subentry regexp constants and
address@hidden regexp constants @subentry in @command{gawk}
@noindent
This code is ``obviously'' testing @code{$1} for a match against the regexp
@code{/foo/}. But in fact, the expression @samp{/foo/ ~ $1} really means
@@ -10853,8 +10853,8 @@ matches = /foo/
assigns either zero or one to the variable @code{matches}, depending
upon the contents of the current input record.
address@hidden differences in @command{awk} and @command{gawk}, regexp constants
address@hidden dark corner, regexp constants, as arguments to user-defined
functions
address@hidden differences in @command{awk} and @command{gawk} @subentry regexp
constants
address@hidden dark corner @subentry regexp constants @subentry as arguments to
user-defined functions
@cindexgawkfunc{gensub}
@cindexawkfunc{sub}
@cindexawkfunc{gsub}
@@ -10929,7 +10929,7 @@ it would be nice to have regexp constants that
are @dfn{strongly typed}; in other words, that denote a regexp useful
for matching, and not an expression.
address@hidden values, regexp
address@hidden values @subentry regexp
@command{gawk} provides this feature. A strongly typed regexp constant
looks almost like a regular regexp constant, except that it is preceded
by an @samp{@@} sign:
@@ -10992,8 +10992,8 @@ value of the original regexp text.
@node Variables
@subsection Variables
address@hidden variables, user-defined
address@hidden user-defined, variables
address@hidden variables @subentry user-defined
address@hidden user-defined @subentry variables
@dfn{Variables} are ways of storing values at one point in your program for
use later in another part of your program. They can be manipulated
entirely within the program text, and they can also be assigned values
@@ -11029,8 +11029,8 @@ change a variable's value, and the @code{match()},
@code{split()},
and @code{patsplit()} functions can change the contents of their
array parameters (@pxref{String Functions}).
address@hidden variables, built-in
address@hidden variables, initializing
address@hidden variables @subentry built-in
address@hidden variables @subentry initializing
A few variables have special built-in meanings, such as @code{FS} (the
field separator) and @code{NF} (the number of fields in the current input
record). @xref{Built-in Variables} for a list of the predefined variables.
@@ -11047,8 +11047,8 @@ which is what you would do in C and in most other
traditional languages.
@node Assignment Options
@subsubsection Assigning Variables on the Command Line
address@hidden variables, assigning on command line
address@hidden command line, address@hidden assigning on
address@hidden variables @subentry assigning on command line
address@hidden command line @subentry variables, assigning on
Any @command{awk} variable can be set by including a @dfn{variable assignment}
among the arguments on the command line when @command{awk} is invoked
@@ -11102,7 +11102,7 @@ $ @kbd{awk '@{ print $n @}' n=4 inventory-shipped n=2
mail-list}
@dots{}
@end example
address@hidden dark corner, command-line arguments
address@hidden dark corner @subentry command-line arguments
Command-line arguments are made available for explicit examination by
the @command{awk} program in the @code{ARGV} array
(@pxref{ARGC and ARGV}).
@@ -11143,10 +11143,10 @@ this @value{SECTION} discusses this important facet
of @command{awk}.
@node Strings And Numbers
@subsubsection How @command{awk} Converts Between Strings and Numbers
address@hidden converting, strings to numbers
address@hidden strings, converting
address@hidden numbers, converting
address@hidden converting, numbers to strings
address@hidden converting @subentry strings to numbers
address@hidden strings @subentry converting
address@hidden numbers @subentry converting
address@hidden converting @subentry numbers to strings
Strings are converted to numbers and numbers are converted to strings, if the
context
of the @command{awk} program demands it. For example, if the value of
either @code{foo} or @code{bar} in the expression @samp{foo + bar}
@@ -11167,7 +11167,7 @@ the variables @code{two} and @code{three} are converted
to strings and
concatenated together. The resulting string is converted back to the
number 23, to which 4 is then added.
address@hidden null strings, converting numbers to strings
address@hidden null strings @subentry converting numbers to strings
@cindex type conversion
If, for some reason, you need to force a number to be converted to a
string, concatenate that number with the empty string, @code{""}.
@@ -11194,7 +11194,7 @@ On most modern machines,
value address@hidden cases can require up to
752 digits (!), but we doubt that you need to worry about this.}
address@hidden dark corner, @code{CONVFMT} variable
address@hidden dark corner @subentry @code{CONVFMT} variable
Strange results can occur if you set @code{CONVFMT} to a string that doesn't
tell @code{sprintf()} how to format floating-point numbers in a useful way.
For example, if you forget the @samp{%} in the format, @command{awk} converts
@@ -11215,10 +11215,10 @@ b = a ""
@value{DARKCORNER}
@sidebar Pre-POSIX @command{awk} Used @code{OFMT} for String Conversion
address@hidden POSIX @command{awk}, @code{OFMT} variable and
address@hidden POSIX @command{awk} @subentry @code{OFMT} variable and
@cindex @code{OFMT} variable
address@hidden portability, new @command{awk} vs.@: old @command{awk}
address@hidden @command{awk}, new vs.@: old, @code{OFMT} variable
address@hidden portability @subentry new @command{awk} vs.@: old @command{awk}
address@hidden @command{awk} @subentry new vs.@: old @subentry @code{OFMT}
variable
Prior to the POSIX standard, @command{awk} used the value
of @code{OFMT} for converting numbers to strings. @code{OFMT}
specifies the output format to use when printing numbers with @code{print}.
@@ -11243,7 +11243,7 @@ non-English locales use the comma (@samp{,}) as the
decimal point
character. European locales often use either a space or a period as
the thousands separator, if they have one.
address@hidden dark corner, locale's decimal point character
address@hidden dark corner @subentry locale's decimal point character
The POSIX standard says that @command{awk} always uses the period as the
decimal
point when reading the @command{awk} program source code, and for
command-line variable assignments (@pxref{Other Arguments}). However,
@@ -11318,7 +11318,7 @@ of the values provided by constants and variables.
@node Arithmetic Ops
@subsection Arithmetic Operators
@cindex arithmetic operators
address@hidden operators, arithmetic
address@hidden operators @subentry arithmetic
@c @cindex addition
@c @cindex subtraction
@c @cindex multiplication
@@ -11357,9 +11357,9 @@ The following list provides the arithmetic operators in
@command{awk},
in order from the highest precedence to the lowest:
@table @code
address@hidden common extensions, @code{**} operator
address@hidden extensions, address@hidden @code{**} operator
address@hidden POSIX @command{awk}, arithmetic operators and
address@hidden common extensions @subentry @code{**} operator
address@hidden extensions @subentry common, @code{**} operator
address@hidden POSIX @command{awk} @subentry arithmetic operators and
@item @var{x} ^ @var{y}
@itemx @var{x} ** @var{y}
Exponentiation; @var{x} raised to the @var{y} power. @samp{2 ^ 3} has
@@ -11375,7 +11375,7 @@ Unary plus; the expression is converted to a number.
@item @var{x} * @var{y}
Multiplication.
address@hidden troubleshooting, division
address@hidden troubleshooting @subentry division
@cindex division
@item @var{x} / @var{y}
Division; because all numbers in @command{awk} are floating-point
@@ -11400,7 +11400,7 @@ Unary plus and minus have the same precedence,
the multiplication operators all have the same precedence, and
addition and subtraction have the same precedence.
address@hidden differences in @command{awk} and @command{gawk}, trunc-mod
operation
address@hidden differences in @command{awk} and @command{gawk} @subentry
trunc-mod operation
@cindex trunc-mod operation
When computing the remainder of @address@hidden % @var{y}},
the quotient is rounded toward zero to an integer and
@@ -11423,9 +11423,9 @@ In other @command{awk} implementations, the signedness
of the remainder
may be machine-dependent.
@c FIXME !!! what does posix say?
address@hidden portability, @code{**} operator and
address@hidden @code{*} (asterisk), @code{**} operator
address@hidden asterisk (@code{*}), @code{**} operator
address@hidden portability @subentry @code{**} operator and
address@hidden @code{*} (asterisk) @subentry @code{**} operator
address@hidden asterisk (@code{*}) @subentry @code{**} operator
@quotation NOTE
The POSIX standard only specifies the use of @samp{^}
for exponentiation.
@@ -11441,7 +11441,7 @@ For maximum portability, do not use the @samp{**}
operator.
@end quotation
@cindex string operators
address@hidden operators, string
address@hidden operators @subentry string
@cindex concatenating
There is only one string operation: concatenation. It does not have a
specific operator to represent it. Instead, concatenation is performed by
@@ -11464,7 +11464,7 @@ $ @kbd{awk '@{ print "Field number one:" $1 @}'
mail-list}
@dots{}
@end example
address@hidden troubleshooting, string concatenation
address@hidden troubleshooting @subentry string concatenation
Because string concatenation does not have an explicit operator, it is
often necessary to ensure that it happens at the right time by using
parentheses to enclose the items to concatenate. For example,
@@ -11491,7 +11491,7 @@ print "something meaningful" > (file name)
@end example
@cindex order of evaluation, concatenation
address@hidden evaluation order, concatenation
address@hidden evaluation order @subentry concatenation
@cindex side effects
Parentheses should be used around concatenation in all but the
most common contexts, such as on the righthand side of @samp{=}.
@@ -11572,10 +11572,10 @@ you're never quite sure what you'll get.
@node Assignment Ops
@subsection Assignment Expressions
@cindex assignment operators
address@hidden operators, assignment
address@hidden expressions, assignment
address@hidden @code{=} (equals sign), @code{=} operator
address@hidden equals sign (@code{=}), @code{=} operator
address@hidden operators @subentry assignment
address@hidden expressions @subentry assignment
address@hidden @code{=} (equals sign) @subentry @code{=} operator
address@hidden equals sign (@code{=}) @subentry @code{=} operator
An @dfn{assignment} is an expression that stores a (usually different)
value into a variable. For example, let's assign the value one to the variable
@code{z}:
@@ -11598,7 +11598,7 @@ message = "this " thing " is " predicate
@end example
@noindent
address@hidden side effects, assignment expressions
address@hidden side effects @subentry assignment expressions
This also illustrates string concatenation.
The @samp{=} sign is called an @dfn{assignment operator}. It is the
simplest assignment operator because the value of the righthand
@@ -11612,8 +11612,8 @@ a @dfn{side effect}.
@cindex lvalues/rvalues
@cindex rvalues/lvalues
address@hidden assignment operators, lvalues/rvalues
address@hidden operators, assignment
address@hidden assignment operators @subentry lvalues/rvalues
address@hidden operators @subentry assignment
The lefthand operand of an assignment need not be a variable
(@pxref{Variables}); it can also be a field
(@pxref{Changing Fields}) or
@@ -11624,7 +11624,7 @@ The righthand operand may be any expression; it
produces the new value
that the assignment stores in the specified variable, field, or array
element. (Such values are called @dfn{rvalues}.)
address@hidden variables, types of
address@hidden variables @subentry types of
It is important to note that variables do @emph{not} have permanent types.
A variable's type is simply the type of whatever value was last assigned
to it. In the following program fragment, the variable
@@ -11682,8 +11682,8 @@ and then test whether @code{x} equals one. But this
style tends to make
programs hard to read; such nesting of assignments should be avoided,
except perhaps in a one-shot program.
address@hidden @code{+} (plus sign), @code{+=} operator
address@hidden plus sign (@code{+}), @code{+=} operator
address@hidden @code{+} (plus sign) @subentry @code{+=} operator
address@hidden plus sign (@code{+}) @subentry @code{+=} operator
Aside from @samp{=}, there are several other assignment operators that
do arithmetic with the old value of the variable. For example, the
operator @samp{+=} computes a new value by adding the righthand value
@@ -11726,8 +11726,8 @@ BEGIN @{
@end group
@end example
address@hidden operators, assignment, evaluation order
address@hidden assignment operators, evaluation order
address@hidden operators @subentry assignment @subentry evaluation order
address@hidden assignment operators @subentry evaluation order
@noindent
The indices of @code{bar} are practically guaranteed to be different, because
@code{rand()} returns different values each time it is called.
@@ -11760,18 +11760,18 @@ The value of @code{a[3]} could be either two or four.
case, the righthand operand is an expression whose value is converted
to a number.
address@hidden @code{-} (hyphen), @code{-=} operator
address@hidden hyphen (@code{-}), @code{-=} operator
address@hidden @code{*} (asterisk), @code{*=} operator
address@hidden asterisk (@code{*}), @code{*=} operator
address@hidden @code{/} (forward slash), @code{/=} operator
address@hidden forward slash (@code{/}), @code{/=} operator
address@hidden @code{%} (percent sign), @code{%=} operator
address@hidden percent sign (@code{%}), @code{%=} operator
address@hidden @code{^} (caret), @code{^=} operator
address@hidden caret (@code{^}), @code{^=} operator
address@hidden @code{*} (asterisk), @code{**=} operator
address@hidden asterisk (@code{*}), @code{**=} operator
address@hidden @code{-} (hyphen) @subentry @code{-=} operator
address@hidden hyphen (@code{-}) @subentry @code{-=} operator
address@hidden @code{*} (asterisk) @subentry @code{*=} operator
address@hidden asterisk (@code{*}) @subentry @code{*=} operator
address@hidden @code{/} (forward slash) @subentry @code{/=} operator
address@hidden forward slash (@code{/}) @subentry @code{/=} operator
address@hidden @code{%} (percent sign) @subentry @code{%=} operator
address@hidden percent sign (@code{%}) @subentry @code{%=} operator
address@hidden @code{^} (caret) @subentry @code{^=} operator
address@hidden caret (@code{^}) @subentry @code{^=} operator
address@hidden @code{*} (asterisk) @subentry @code{**=} operator
address@hidden asterisk (@code{*}) @subentry @code{**=} operator
@float Table,table-assign-ops
@caption{Arithmetic assignment operators}
@multitable @columnfractions .30 .70
@@ -11781,8 +11781,8 @@ to a number.
@item @var{lvalue} @code{*=} @var{coefficient} @tab Multiply the value of
@var{lvalue} by @var{coefficient}.
@item @var{lvalue} @code{/=} @var{divisor} @tab Divide the value of
@var{lvalue} by @var{divisor}.
@item @var{lvalue} @code{%=} @var{modulus} @tab Set @var{lvalue} to its
remainder by @var{modulus}.
address@hidden common extensions, @code{**=} operator
address@hidden extensions, address@hidden @code{**=} operator
address@hidden common extensions @subentry @code{**=} operator
address@hidden extensions @subentry common, @code{**=} operator
@cindex @command{awk} language, POSIX version
@cindex POSIX @command{awk}
@item @var{lvalue} @code{^=} @var{power} @tab Raise @var{lvalue} to the power
@var{power}.
@@ -11790,23 +11790,23 @@ to a number.
@end multitable
@end float
address@hidden POSIX @command{awk}, @code{**=} operator and
address@hidden portability, @code{**=} operator and
address@hidden POSIX @command{awk} @subentry @code{**=} operator and
address@hidden portability @subentry @code{**=} operator and
@quotation NOTE
Only the @samp{^=} operator is specified by POSIX.
For maximum portability, do not use the @samp{**=} operator.
@end quotation
@sidebar Syntactic Ambiguities Between @samp{/=} and Regular Expressions
address@hidden dark corner, regexp constants, @code{/=} operator and
address@hidden @code{/} (forward slash), @code{/=} operator, vs.
@code{/address@hidden/} regexp constant
address@hidden forward slash (@code{/}), @code{/=} operator, vs.
@code{/address@hidden/} regexp constant
address@hidden regexp constants, @code{/address@hidden/}, @code{/=} operator and
address@hidden dark corner @subentry regexp constants @subentry @code{/=}
operator and
address@hidden @code{/} (forward slash) @subentry @code{/=} operator @subentry
vs. @code{/address@hidden/} regexp constant
address@hidden forward slash (@code{/}) @subentry @code{/=} operator @subentry
vs. @code{/address@hidden/} regexp constant
address@hidden regexp constants @subentry @code{/address@hidden/} @subentry
@code{/=} operator and
@c derived from email from "Nelson H. F. Beebe" <address@hidden>
@c Date: Mon, 1 Sep 1997 13:38:35 -0600 (MDT)
address@hidden dark corner, @code{/=} operator vs. @code{/address@hidden/}
regexp constant
address@hidden dark corner @subentry @code{/=} operator vs.
@code{/address@hidden/} regexp constant
@cindex ambiguity, syntactic: @code{/=} operator vs. @code{/address@hidden/}
regexp constant
@cindex syntactic ambiguity: @code{/=} operator vs. @code{/address@hidden/}
regexp constant
@cindex @code{/=} operator vs. @code{/address@hidden/} regexp constant
@@ -11839,16 +11839,16 @@ and @command{mawk} also do not.
@subsection Increment and Decrement Operators
@cindex increment operators
address@hidden operators, decrement/increment
address@hidden operators @subentry decrement/increment
@dfn{Increment} and @dfn{decrement operators} increase or decrease the value of
a variable by one. An assignment operator can do the same thing, so
the increment operators add no power to the @command{awk} language; however,
they
are convenient abbreviations for very common operations.
@cindex side effects
address@hidden @code{+} (plus sign), @code{++} operator
address@hidden plus sign (@code{+}), @code{++} operator
address@hidden side effects, decrement/increment operators
address@hidden @code{+} (plus sign) @subentry @code{++} operator
address@hidden plus sign (@code{+}) @subentry @code{++} operator
address@hidden side effects @subentry decrement/increment operators
The operator used for adding one is written @samp{++}. It can be used to
increment
a variable either before or after taking its value.
To @dfn{pre-increment} a variable @code{v}, write @samp{++v}. This adds
@@ -11879,8 +11879,8 @@ long as you stick to numbers that are fairly small
(less than
@end ifnotinfo
@end ifnottex
address@hidden @code{$} (dollar sign), incrementing fields and arrays
address@hidden dollar sign (@code{$}), incrementing fields and arrays
address@hidden @code{$} (dollar sign) @subentry incrementing fields and arrays
address@hidden dollar sign (@code{$}) @subentry incrementing fields and arrays
Fields and array elements are incremented
just like variables. (Use @samp{$(i++)} when you want to do a field reference
and a variable increment at the same time. The parentheses are necessary
@@ -11893,8 +11893,8 @@ the lvalue to pre-decrement or after it to
post-decrement.
Following is a summary of increment and decrement expressions:
@table @code
address@hidden @code{+} (plus sign), @code{++} operator
address@hidden plus sign (@code{+}), @code{++} operator
address@hidden @code{+} (plus sign) @subentry @code{++} operator
address@hidden plus sign (@code{+}) @subentry @code{++} operator
@item address@hidden
Increment @var{lvalue}, returning the new value as the
value of the expression.
@@ -11903,8 +11903,8 @@ value of the expression.
Increment @var{lvalue}, returning the @emph{old} value of @var{lvalue}
as the value of the expression.
address@hidden @code{-} (hyphen), @code{--} operator
address@hidden hyphen (@code{-}), @code{--} operator
address@hidden @code{-} (hyphen) @subentry @code{--} operator
address@hidden hyphen (@code{-}) @subentry @code{--} operator
@item address@hidden
Decrement @var{lvalue}, returning the new value as the
value of the expression.
@@ -11920,8 +11920,8 @@ like @address@hidden, but instead of adding, it
subtracts.)
@sidebar Operator Evaluation Order
@cindex precedence
address@hidden operators, precedence of
address@hidden portability, operators
address@hidden operators @subentry precedence of
address@hidden portability @subentry operators
@cindex evaluation order
@cindex Marx, Groucho
@quotation
@@ -12013,7 +12013,7 @@ BEGIN @{
@}
@end example
address@hidden dark corner, @code{"0"} is actually true
address@hidden dark corner @subentry @code{"0"} is actually true
There is a surprising consequence of the ``nonzero or non-null'' rule:
the string constant @code{"0"} is actually true, because it is non-null.
@value{DARKCORNER}
@@ -12029,13 +12029,13 @@ the string constant @code{"0"} is actually true,
because it is non-null.
@c leave it alone.
@cindex comparison expressions
address@hidden expressions, comparison
address@hidden expressions @subentry comparison
@cindex expressions, matching @seeentry{comparison expressions}
@cindex matching, expressions @seeentry{comparison expressions}
@cindex relational operators @seeentry{comparison operators}
@cindex operators, relational @address@hidden comparison}
@cindex variable typing
address@hidden variables, types of, comparison expressions and
address@hidden variables @subentry types of @subentry comparison expressions and
Unlike in other programming languages, in @command{awk} variables do not have a
fixed type. Instead, they can be either a number or a string, depending
upon the value that is assigned to them.
@@ -12129,9 +12129,9 @@ $ @kbd{echo 37 | awk '@{ printf("%s %s < 42\n", $1,}
Here are the rules for when @command{awk}
treats data as a number, and for when it treats data as a string.
address@hidden numeric, strings
address@hidden strings, numeric
address@hidden POSIX @command{awk}, numeric strings and
address@hidden numeric @subentry strings
address@hidden strings @subentry numeric
address@hidden POSIX @command{awk} @subentry numeric strings and
The POSIX standard uses the term @dfn{numeric string} for input data that
looks numeric. The @samp{37} in the previous example is a numeric string.
So what is the type of a numeric string? Answer: numeric.
@@ -12349,22 +12349,22 @@ relationships such as equality. They are written
using @dfn{relational
operators}, which are a superset of those in C.
@ref{table-relational-ops} describes them.
address@hidden @code{<} (left angle bracket), @code{<} operator
address@hidden left angle bracket (@code{<}), @code{<} operator
address@hidden @code{<} (left angle bracket), @code{<=} operator
address@hidden left angle bracket (@code{<}), @code{<=} operator
address@hidden @code{>} (right angle bracket), @code{>=} operator
address@hidden right angle bracket (@code{>}), @code{>=} operator
address@hidden @code{>} (right angle bracket), @code{>} operator
address@hidden right angle bracket (@code{>}), @code{>} operator
address@hidden @code{=} (equals sign), @code{==} operator
address@hidden equals sign (@code{=}), @code{==} operator
address@hidden @code{!} (exclamation point), @code{!=} operator
address@hidden exclamation point (@code{!}), @code{!=} operator
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @code{<} (left angle bracket) @subentry @code{<} operator
address@hidden left angle bracket (@code{<}) @subentry @code{<} operator
address@hidden @code{<} (left angle bracket) @subentry @code{<=} operator
address@hidden left angle bracket (@code{<}) @subentry @code{<=} operator
address@hidden @code{>} (right angle bracket) @subentry @code{>=} operator
address@hidden right angle bracket (@code{>}) @subentry @code{>=} operator
address@hidden @code{>} (right angle bracket) @subentry @code{>} operator
address@hidden right angle bracket (@code{>}) @subentry @code{>} operator
address@hidden @code{=} (equals sign) @subentry @code{==} operator
address@hidden equals sign (@code{=}) @subentry @code{==} operator
address@hidden @code{!} (exclamation point) @subentry @code{!=} operator
address@hidden exclamation point (@code{!}) @subentry @code{!=} operator
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
@cindex @code{in} operator
@float Table,table-relational-ops
@caption{Relational operators}
@@ -12393,7 +12393,7 @@ and so on. Thus, @code{"10"} is less than @code{"9"}.
If there are two
strings where one is a prefix of the other, the shorter string is less than
the longer one. Thus, @code{"abc"} is less than @code{"abcd"}.
address@hidden troubleshooting, @code{==} operator
address@hidden troubleshooting @subentry @code{==} operator
It is very easy to accidentally mistype the @samp{==} operator and
leave off one of the @samp{=} characters. The result is still valid
@command{awk} code, but the program does not do what is intended:
@@ -12445,7 +12445,7 @@ $ @kbd{echo 1e2 3 | awk '@{ print ($1 < $2) ? "true" :
"false" @}'}
@print{} false
@end example
address@hidden comparison expressions, string vs.@: regexp
address@hidden comparison expressions @subentry string vs.@: regexp
@c @cindex string comparison vs.@: regexp comparison
@c @cindex regexp comparison vs.@: string comparison
@noindent
@@ -12475,17 +12475,17 @@ x ~ /foo/
has the value one if @code{x} contains @samp{foo}, such as
@code{"Oh, what a fool am I!"}.
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
The righthand operand of the @samp{~} and @samp{!~} operators may be
either a regexp constant (@code{/address@hidden@code{/}) or an ordinary
expression. In the latter case, the value of the expression as a string is
used as a
dynamic regexp (@pxref{Regexp Usage}; also
@pxref{Computed Regexps}).
address@hidden @command{awk}, regexp constants and
address@hidden @command{awk} @subentry regexp constants and
@cindex regexp constants
A constant regular
expression in slashes by itself is also an expression.
@@ -12558,7 +12558,7 @@ and http://austingroupbugs.net/view.php?id=1070.
@cindex and Boolean-logic operator
@cindex or Boolean-logic operator
@cindex not Boolean-logic operator
address@hidden expressions, Boolean
address@hidden expressions @subentry Boolean
@cindex Boolean expressions
@cindex operators, Boolean @seeentry{Boolean expressions}
@cindex Boolean operators @seeentry{Boolean expressions}
@@ -12595,7 +12595,7 @@ both @samp{edu} and @samp{li}:
if ($0 ~ /edu/ && $0 ~ /li/) print
@end example
address@hidden side effects, Boolean operators
address@hidden side effects @subentry Boolean operators
The subexpression @var{boolean2} is evaluated only if @var{boolean1}
is true. This can make a difference when @var{boolean2} contains
expressions that have side effects. In the case of @samp{$0 ~ /foo/ &&
@@ -12635,11 +12635,11 @@ BEGIN @{ if (! ("HOME" in ENVIRON))
@end table
@cindex short-circuit operators
address@hidden operators, short-circuit
address@hidden @code{&} (ampersand), @code{&&} operator
address@hidden ampersand (@code{&}), @code{&&} operator
address@hidden @code{|} (vertical bar), @code{||} operator
address@hidden vertical bar (@code{|}), @code{||} operator
address@hidden operators @subentry short-circuit
address@hidden @code{&} (ampersand) @subentry @code{&&} operator
address@hidden ampersand (@code{&}) @subentry @code{&&} operator
address@hidden @code{|} (vertical bar) @subentry @code{||} operator
address@hidden vertical bar (@code{|}) @subentry @code{||} operator
The @samp{&&} and @samp{||} operators are called @dfn{short-circuit}
operators because of the way they work. Evaluation of the full expression
is ``short-circuited'' if the result can be determined partway through
@@ -12651,10 +12651,10 @@ by putting a newline after them. But you cannot put
a newline in front
of either of these operators without using backslash continuation
(@pxref{Statements/Lines}).
address@hidden @code{!} (exclamation point), @code{!} operator
address@hidden exclamation point (@code{!}), @code{!} operator
address@hidden @code{!} (exclamation point) @subentry @code{!} operator
address@hidden exclamation point (@code{!}) @subentry @code{!} operator
@cindex newlines
address@hidden variables, flag
address@hidden variables @subentry flag
@cindex flag variables
The actual value of an expression using the @samp{!} operator is
either one or zero, depending upon the truth value of the expression it
@@ -12708,8 +12708,8 @@ The reason it's there is to avoid printing the
bracketing
@node Conditional Exp
@subsection Conditional Expressions
@cindex conditional expressions
address@hidden expressions, conditional
address@hidden expressions, selecting
address@hidden expressions @subentry conditional
address@hidden expressions @subentry selecting
A @dfn{conditional expression} is a special kind of expression that has
three operands. It allows you to use one expression's value to select
@@ -12733,7 +12733,7 @@ For example, the following expression produces the
absolute value of @code{x}:
x >= 0 ? x : -x
@end example
address@hidden side effects, conditional expressions
address@hidden side effects @subentry conditional expressions
Each time the conditional expression is computed, only one of
@var{if-true-exp} and @var{if-false-exp} is used; the other is ignored.
This is important when the expressions have side effects. For example,
@@ -12751,9 +12751,9 @@ and the other is not.
@xref{Arrays},
for more information about arrays.
address@hidden differences in @command{awk} and @command{gawk}, line
continuations
address@hidden line continuations, @command{gawk}
address@hidden @command{gawk}, line continuation in
address@hidden differences in @command{awk} and @command{gawk} @subentry line
continuations
address@hidden line continuations @subentry @command{gawk}
address@hidden @command{gawk} @subentry line continuation in
As a minor @command{gawk} extension,
a statement that uses @samp{?:} can be continued simply
by putting a newline after either character.
@@ -12772,7 +12772,7 @@ This enables you to
ask for it by name at any point in the program. For
example, the function @code{sqrt()} computes the square root of a number.
address@hidden functions, built-in
address@hidden functions @subentry built-in
A fixed set of functions are @dfn{built in}, which means they are
available in every @command{awk} program. The @code{sqrt()} function is one
of these. @xref{Built-in} for a list of built-in
@@ -12783,7 +12783,7 @@ for instructions on how to do this.
Finally, @command{gawk} lets you write functions in C or C++
that may be called from your program (@pxref{Dynamic Extensions}).
address@hidden arguments, in function calls
address@hidden arguments @subentry in function calls
The way to use a function is with a @dfn{function call} expression,
which consists of the function name followed immediately by a list of
@dfn{arguments} in parentheses. The arguments are expressions that
@@ -12798,7 +12798,7 @@ atan2(y, x) @ii{two arguments}
rand() @ii{no arguments}
@end example
address@hidden troubleshooting, function call syntax
address@hidden troubleshooting @subentry function call syntax
@quotation CAUTION
Do not put any space between the function name and the opening parenthesis!
A user-defined function name looks just like the name of a
@@ -12833,7 +12833,7 @@ which is a way to choose the function to call at
runtime, instead of
when you write the source code to your program. We defer discussion of
this feature until later; see @ref{Indirect Calls}.
address@hidden side effects, function calls
address@hidden side effects @subentry function calls
Like every other expression, the function call has a value, often
called the @dfn{return value}, which is computed by the function
based on the arguments you give it. In this example, the return value
@@ -12883,7 +12883,7 @@ $ @kbd{awk -f matchit.awk}
@node Precedence
@section Operator Precedence (How Operators Nest)
@cindex precedence
address@hidden operators, precedence
address@hidden operators @subentry precedence
@dfn{Operator precedence} determines how operators are grouped when
different operators appear close by in one expression. For example,
@@ -12930,47 +12930,47 @@ to lowest precedence:
@item @code{(address@hidden@code{)}
Grouping.
address@hidden @code{$} (dollar sign), @code{$} field operator
address@hidden dollar sign (@code{$}), @code{$} field operator
address@hidden @code{$} (dollar sign) @subentry @code{$} field operator
address@hidden dollar sign (@code{$}) @subentry @code{$} field operator
@item @code{$}
Field reference.
address@hidden @code{+} (plus sign), @code{++} operator
address@hidden plus sign (@code{+}), @code{++} operator
address@hidden @code{-} (hyphen), @code{--} operator
address@hidden hyphen (@code{-}), @code{--} operator
address@hidden @code{+} (plus sign) @subentry @code{++} operator
address@hidden plus sign (@code{+}) @subentry @code{++} operator
address@hidden @code{-} (hyphen) @subentry @code{--} operator
address@hidden hyphen (@code{-}) @subentry @code{--} operator
@item @code{++ --}
Increment, decrement.
address@hidden @code{^} (caret), @code{^} operator
address@hidden caret (@code{^}), @code{^} operator
address@hidden @code{*} (asterisk), @code{**} operator
address@hidden asterisk (@code{*}), @code{**} operator
address@hidden @code{^} (caret) @subentry @code{^} operator
address@hidden caret (@code{^}) @subentry @code{^} operator
address@hidden @code{*} (asterisk) @subentry @code{**} operator
address@hidden asterisk (@code{*}) @subentry @code{**} operator
@item @code{^ **}
Exponentiation. These operators group right to left.
address@hidden @code{+} (plus sign), @code{+} operator
address@hidden plus sign (@code{+}), @code{+} operator
address@hidden @code{-} (hyphen), @code{-} operator
address@hidden hyphen (@code{-}), @code{-} operator
address@hidden @code{!} (exclamation point), @code{!} operator
address@hidden exclamation point (@code{!}), @code{!} operator
address@hidden @code{+} (plus sign) @subentry @code{+} operator
address@hidden plus sign (@code{+}) @subentry @code{+} operator
address@hidden @code{-} (hyphen) @subentry @code{-} operator
address@hidden hyphen (@code{-}) @subentry @code{-} operator
address@hidden @code{!} (exclamation point) @subentry @code{!} operator
address@hidden exclamation point (@code{!}) @subentry @code{!} operator
@item @code{+ - !}
Unary plus, minus, logical ``not.''
address@hidden @code{*} (asterisk), @code{*} operator, as multiplication
operator
address@hidden asterisk (@code{*}), @code{*} operator, as multiplication
operator
address@hidden @code{/} (forward slash), @code{/} operator
address@hidden forward slash (@code{/}), @code{/} operator
address@hidden @code{%} (percent sign), @code{%} operator
address@hidden percent sign (@code{%}), @code{%} operator
address@hidden @code{*} (asterisk) @subentry @code{*} operator @subentry as
multiplication operator
address@hidden asterisk (@code{*}) @subentry @code{*} operator @subentry as
multiplication operator
address@hidden @code{/} (forward slash) @subentry @code{/} operator
address@hidden forward slash (@code{/}) @subentry @code{/} operator
address@hidden @code{%} (percent sign) @subentry @code{%} operator
address@hidden percent sign (@code{%}) @subentry @code{%} operator
@item @code{* / %}
Multiplication, division, remainder.
address@hidden @code{+} (plus sign), @code{+} operator
address@hidden plus sign (@code{+}), @code{+} operator
address@hidden @code{-} (hyphen), @code{-} operator
address@hidden hyphen (@code{-}), @code{-} operator
address@hidden @code{+} (plus sign) @subentry @code{+} operator
address@hidden plus sign (@code{+}) @subentry @code{+} operator
address@hidden @code{-} (hyphen) @subentry @code{-} operator
address@hidden hyphen (@code{-}) @subentry @code{-} operator
@item @code{+ -}
Addition, subtraction.
@@ -12979,35 +12979,35 @@ There is no special symbol for concatenation.
The operands are simply written side by side
(@pxref{Concatenation}).
address@hidden @code{<} (left angle bracket), @code{<} operator
address@hidden left angle bracket (@code{<}), @code{<} operator
address@hidden @code{<} (left angle bracket), @code{<=} operator
address@hidden left angle bracket (@code{<}), @code{<=} operator
address@hidden @code{>} (right angle bracket), @code{>=} operator
address@hidden right angle bracket (@code{>}), @code{>=} operator
address@hidden @code{>} (right angle bracket), @code{>} operator
address@hidden right angle bracket (@code{>}), @code{>} operator
address@hidden @code{=} (equals sign), @code{==} operator
address@hidden equals sign (@code{=}), @code{==} operator
address@hidden @code{!} (exclamation point), @code{!=} operator
address@hidden exclamation point (@code{!}), @code{!=} operator
address@hidden @code{>} (right angle bracket), @code{>>} operator (I/O)
address@hidden right angle bracket (@code{>}), @code{>>} operator (I/O)
address@hidden operators, input/output
address@hidden @code{|} (vertical bar), @code{|} operator (I/O)
address@hidden vertical bar (@code{|}), @code{|} operator (I/O)
address@hidden operators, input/output
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}), @code{|&} operator (I/O)
address@hidden operators, input/output
address@hidden @code{<} (left angle bracket) @subentry @code{<} operator
address@hidden left angle bracket (@code{<}) @subentry @code{<} operator
address@hidden @code{<} (left angle bracket) @subentry @code{<=} operator
address@hidden left angle bracket (@code{<}) @subentry @code{<=} operator
address@hidden @code{>} (right angle bracket) @subentry @code{>=} operator
address@hidden right angle bracket (@code{>}) @subentry @code{>=} operator
address@hidden @code{>} (right angle bracket) @subentry @code{>} operator
address@hidden right angle bracket (@code{>}) @subentry @code{>} operator
address@hidden @code{=} (equals sign) @subentry @code{==} operator
address@hidden equals sign (@code{=}) @subentry @code{==} operator
address@hidden @code{!} (exclamation point) @subentry @code{!=} operator
address@hidden exclamation point (@code{!}) @subentry @code{!=} operator
address@hidden @code{>} (right angle bracket) @subentry @code{>>} operator (I/O)
address@hidden right angle bracket (@code{>}) @subentry @code{>>} operator (I/O)
address@hidden operators @subentry input/output
address@hidden @code{|} (vertical bar) @subentry @code{|} operator (I/O)
address@hidden vertical bar (@code{|}) @subentry @code{|} operator (I/O)
address@hidden operators @subentry input/output
address@hidden @code{|} (vertical bar) @subentry @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}) @subentry @code{|&} operator (I/O)
address@hidden operators @subentry input/output
@item @code{< <= == != > >= >> | |&}
Relational and redirection.
The relational operators and the redirections have the same precedence
level. Characters such as @samp{>} serve both as relationals and as
redirections; the context distinguishes between the two meanings.
address@hidden @code{print} statement, I/O operators in
address@hidden @code{printf} statement, I/O operators in
address@hidden @code{print} statement @subentry I/O operators in
address@hidden @code{printf} statement @subentry I/O operators in
Note that the I/O redirection operators in @code{print} and @code{printf}
statements belong to the statement level, not to expressions. The
redirection does not produce an expression that could be the operand of
@@ -13017,10 +13017,10 @@ parentheses. Such combinations (e.g., @samp{print
foo > a ? b : c})
result in syntax errors.
The correct way to write this statement is @samp{print foo > (a ? b : c)}.
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
@item @code{~ !~}
Matching, nonmatching.
@@ -13028,43 +13028,43 @@ Matching, nonmatching.
@item @code{in}
Array membership.
address@hidden @code{&} (ampersand), @code{&&} operator
address@hidden ampersand (@code{&}), @code{&&} operator
address@hidden @code{&} (ampersand) @subentry @code{&&} operator
address@hidden ampersand (@code{&}) @subentry @code{&&} operator
@item @code{&&}
Logical ``and.''
address@hidden @code{|} (vertical bar), @code{||} operator
address@hidden vertical bar (@code{|}), @code{||} operator
address@hidden @code{|} (vertical bar) @subentry @code{||} operator
address@hidden vertical bar (@code{|}) @subentry @code{||} operator
@item @code{||}
Logical ``or.''
address@hidden @code{?} (question mark), @code{?:} operator
address@hidden question mark (@code{?}), @code{?:} operator
address@hidden @code{:} (colon), @code{?:} operator
address@hidden colon (@code{:}), @code{?:} operator
address@hidden @code{?} (question mark) @subentry @code{?:} operator
address@hidden question mark (@code{?}) @subentry @code{?:} operator
address@hidden @code{:} (colon) @subentry @code{?:} operator
address@hidden colon (@code{:}) @subentry @code{?:} operator
@item @code{?:}
Conditional. This operator groups right to left.
address@hidden @code{+} (plus sign), @code{+=} operator
address@hidden plus sign (@code{+}), @code{+=} operator
address@hidden @code{-} (hyphen), @code{-=} operator
address@hidden hyphen (@code{-}), @code{-=} operator
address@hidden @code{*} (asterisk), @code{*=} operator
address@hidden asterisk (@code{*}), @code{*=} operator
address@hidden @code{*} (asterisk), @code{**=} operator
address@hidden asterisk (@code{*}), @code{**=} operator
address@hidden @code{/} (forward slash), @code{/=} operator
address@hidden forward slash (@code{/}), @code{/=} operator
address@hidden @code{%} (percent sign), @code{%=} operator
address@hidden percent sign (@code{%}), @code{%=} operator
address@hidden @code{^} (caret), @code{^=} operator
address@hidden caret (@code{^}), @code{^=} operator
address@hidden @code{+} (plus sign) @subentry @code{+=} operator
address@hidden plus sign (@code{+}) @subentry @code{+=} operator
address@hidden @code{-} (hyphen) @subentry @code{-=} operator
address@hidden hyphen (@code{-}) @subentry @code{-=} operator
address@hidden @code{*} (asterisk) @subentry @code{*=} operator
address@hidden asterisk (@code{*}) @subentry @code{*=} operator
address@hidden @code{*} (asterisk) @subentry @code{**=} operator
address@hidden asterisk (@code{*}) @subentry @code{**=} operator
address@hidden @code{/} (forward slash) @subentry @code{/=} operator
address@hidden forward slash (@code{/}) @subentry @code{/=} operator
address@hidden @code{%} (percent sign) @subentry @code{%=} operator
address@hidden percent sign (@code{%}) @subentry @code{%=} operator
address@hidden @code{^} (caret) @subentry @code{^=} operator
address@hidden caret (@code{^}) @subentry @code{^=} operator
@item @code{= += -= *= /= %= ^= **=}
Assignment. These operators group right to left.
@end table
address@hidden POSIX @command{awk}, @code{**} operator and
address@hidden portability, operators, not in POSIX @command{awk}
address@hidden POSIX @command{awk} @subentry @code{**} operator and
address@hidden portability @subentry operators @subentry not in POSIX
@command{awk}
@quotation NOTE
The @samp{|&}, @samp{**}, and @samp{**=} operators are not specified by POSIX.
For maximum portability, do not use them.
@@ -13211,7 +13211,7 @@ building something useful.
* Empty:: The empty pattern, which matches every record.
@end menu
address@hidden patterns, types of
address@hidden patterns @subentry types of
Patterns in @command{awk} control the execution of rules---a rule is
executed when its pattern matches the current input record.
The following is a summary of the types of @command{awk} patterns:
@@ -13252,8 +13252,8 @@ The empty pattern matches every input record.
@node Regexp Patterns
@subsection Regular Expressions as Patterns
address@hidden patterns, regular expressions as
address@hidden regular expressions, as patterns
address@hidden patterns @subentry regular expressions as
address@hidden regular expressions @subentry as patterns
Regular expressions are one of the first kinds of patterns presented
in this book.
@@ -13269,8 +13269,8 @@ END @{ print buzzwords, "buzzwords seen" @}
@node Expression Patterns
@subsection Expressions as Patterns
address@hidden expressions, as patterns
address@hidden patterns, expressions as
address@hidden expressions @subentry as patterns
address@hidden patterns @subentry expressions as
Any @command{awk} expression is valid as an @command{awk} pattern.
The pattern matches if the expression's value is nonzero (if a
@@ -13281,8 +13281,8 @@ value depends directly on the new input record's text;
otherwise, it
depends on only what has happened so far in the execution of the
@command{awk} program.
address@hidden comparison expressions, as patterns
address@hidden patterns, comparison expressions as
address@hidden comparison expressions @subentry as patterns
address@hidden patterns @subentry comparison expressions as
Comparison expressions, using the comparison operators described in
@ref{Typing and Comparison},
are a very common kind of pattern.
@@ -13295,12 +13295,12 @@ is used as a dynamic regular expression
The following example prints the second field of each input record
whose first field is precisely @samp{li}:
address@hidden @code{/} (forward slash), patterns and
address@hidden forward slash (@code{/}), patterns and
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @code{/} (forward slash) @subentry patterns and
address@hidden forward slash (@code{/}) @subentry patterns and
address@hidden @code{~} (tilde) @subentry @code{~} operator
@cindex tilde (@code{~}), @code{~} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden @code{!} (exclamation point) @subentry @code{!~} operator
address@hidden exclamation point (@code{!}) @subentry @code{!~} operator
@example
$ @kbd{awk '$1 == "li" @{ print $2 @}' mail-list}
@end example
@@ -13316,15 +13316,15 @@ $ @kbd{awk '$1 ~ /li/ @{ print $2 @}' mail-list}
@print{} 555-6699
@end example
address@hidden regexp constants, as patterns
address@hidden patterns, regexp constants as
address@hidden regexp constants @subentry as patterns
address@hidden patterns @subentry regexp constants as
A regexp constant as a pattern is also a special case of an expression
pattern. The expression @code{/li/} has the value one if @samp{li}
appears in the current input record. Thus, as a pattern, @code{/li/}
matches any record containing @samp{li}.
@cindex Boolean expressions, as patterns
address@hidden patterns, Boolean expressions as
address@hidden patterns @subentry Boolean expressions as
Boolean expressions are also commonly used as patterns.
Whether the pattern
matches an input record depends on whether its subexpressions match.
@@ -13366,10 +13366,10 @@ $ @kbd{awk '! /li/' mail-list}
@end group
@end example
address@hidden @code{BEGIN} pattern, Boolean patterns and
address@hidden @code{END} pattern, Boolean patterns and
address@hidden @code{BEGINFILE} pattern, Boolean patterns and
address@hidden @code{ENDFILE} pattern, Boolean patterns and
address@hidden @code{BEGIN} pattern @subentry Boolean patterns and
address@hidden @code{END} pattern @subentry Boolean patterns and
address@hidden @code{BEGINFILE} pattern @subentry Boolean patterns and
address@hidden @code{ENDFILE} pattern @subentry Boolean patterns and
The subexpressions of a Boolean operator in a pattern can be constant regular
expressions, comparisons, or any other @command{awk} expressions. Range
patterns are not expressions, so they cannot appear inside Boolean
@@ -13385,8 +13385,8 @@ patterns is described in @ref{Precedence}.
@subsection Specifying Record Ranges with Patterns
@cindex range patterns
address@hidden patterns, ranges in
address@hidden lines, matching ranges of
address@hidden patterns @subentry ranges in
address@hidden lines @subentry matching ranges of
@cindex @code{,} (comma), in range patterns
@cindex comma (@code{,}), in range patterns
A @dfn{range pattern} is made of two patterns separated by a comma, in
@@ -13411,7 +13411,7 @@ input record; when this succeeds, the range pattern is
@dfn{turned off} again
for the following record. Then the range pattern goes back to checking
@var{begpat} against each record.
address@hidden @code{if} statement, address@hidden changing
address@hidden @code{if} statement @subentry actions, changing
The record that turns on the range pattern and the one that turns it
off both match the range pattern. If you don't want to operate on
these records, you can write @code{if} statements in the rule's action
@@ -13436,13 +13436,13 @@ looks like this:
@end example
@noindent
address@hidden lines, skipping between markers
address@hidden lines @subentry skipping between markers
@c @cindex flag variables
This program fails because the range pattern is both turned on and turned off
by the first line, which just has a @samp{%} on it. To accomplish this task,
write the program in the following manner, using a flag:
address@hidden @code{!} (exclamation point), @code{!} operator
address@hidden @code{!} (exclamation point) @subentry @code{!} operator
@example
/^%$/ @{ skip = ! skip; next @}
skip == 1 @{ next @} # skip lines with `skip' set
@@ -13468,7 +13468,7 @@ $ @kbd{echo Yes | gawk '(/1/,/2/) || /Yes/'}
@end example
@cindex range patterns, line continuation and
address@hidden dark corner, range patterns, line continuation and
address@hidden dark corner @subentry range patterns @subentry line continuation
and
As a minor point of interest, although it is poor style,
POSIX allows you to put a newline after the comma in
a range pattern. @value{DARKCORNER}
@@ -13510,8 +13510,8 @@ $ @kbd{awk '}
@print{} "li" appears in 4 records.
@end example
address@hidden @code{BEGIN} pattern, operators and
address@hidden @code{END} pattern, operators and
address@hidden @code{BEGIN} pattern @subentry operators and
address@hidden @code{END} pattern @subentry operators and
This program finds the number of records in the input file @file{mail-list}
that contain the string @samp{li}. The @code{BEGIN} rule prints a title
for the report. There is no need to use the @code{BEGIN} rule to
@@ -13559,7 +13559,7 @@ rule checks the @code{FNR} and @code{NR} variables.
@node I/O And BEGIN/END
@subsubsection Input/Output from @code{BEGIN} and @code{END} Rules
address@hidden input/output, from @code{BEGIN} and @code{END}
address@hidden input/output @subentry from @code{BEGIN} and @code{END}
There are several (sometimes subtle) points to be aware of when doing I/O
from a @code{BEGIN} or @code{END} rule.
The first has to do with the value of @code{$0} in a @code{BEGIN}
@@ -13572,11 +13572,11 @@ without a variable (@pxref{Getline}).
Another way is simply to assign a value to @code{$0}.
@cindex Brian Kernighan's @command{awk}
address@hidden differences in @command{awk} and @command{gawk},
@code{BEGIN}/@code{END} patterns
address@hidden POSIX @command{awk}, @code{BEGIN}/@code{END} patterns
address@hidden @code{print} statement, @code{BEGIN}/@code{END} patterns and
address@hidden @code{BEGIN} pattern, @code{print} statement and
address@hidden @code{END} pattern, @code{print} statement and
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{BEGIN}/@code{END} patterns
address@hidden POSIX @command{awk} @subentry @code{BEGIN}/@code{END} patterns
address@hidden @code{print} statement @subentry @code{BEGIN}/@code{END}
patterns and
address@hidden @code{BEGIN} pattern @subentry @code{print} statement and
address@hidden @code{END} pattern @subentry @code{print} statement and
The second point is similar to the first, but from the other direction.
Traditionally, due largely to implementation issues, @code{$0} and
@code{NF} were @emph{undefined} inside an @code{END} rule.
@@ -13599,10 +13599,10 @@ this in @code{BEGIN} rules, it is a very bad idea in
@code{END} rules,
at least in @command{gawk}. It is also poor style, because if an empty
line is needed in the output, the program should print one explicitly.
address@hidden @code{next} statement, @code{BEGIN}/@code{END} patterns and
address@hidden @code{nextfile} statement, @code{BEGIN}/@code{END} patterns and
address@hidden @code{BEGIN} pattern, @code{next}/@code{nextfile} statements and
address@hidden @code{END} pattern, @code{next}/@code{nextfile} statements and
address@hidden @code{next} statement @subentry @code{BEGIN}/@code{END} patterns
and
address@hidden @code{nextfile} statement @subentry @code{BEGIN}/@code{END}
patterns and
address@hidden @code{BEGIN} pattern @subentry @code{next}/@code{nextfile}
statements and
address@hidden @code{END} pattern @subentry @code{next}/@code{nextfile}
statements and
Finally, the @code{next} and @code{nextfile} statements are not allowed
in a @code{BEGIN} rule, because the implicit
read-a-record-and-match-against-the-rules loop has not started yet.
Similarly, those statements
@@ -13619,7 +13619,7 @@ are not valid in an @code{END} rule, because all the
input has been read.
@subsection The @code{BEGINFILE} and @code{ENDFILE} Special Patterns
@cindex @code{BEGINFILE} pattern
@cindex @code{ENDFILE} pattern
address@hidden differences in @command{awk} and @command{gawk},
@code{BEGINFILE}/@code{ENDFILE} patterns
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{BEGINFILE}/@code{ENDFILE} patterns
This @value{SECTION} describes a @command{gawk}-specific feature.
@@ -13654,9 +13654,9 @@ file named on the command line cannot be opened for
reading. However,
you can bypass the fatal error and move on to the next file on the
command line.
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @code{ERRNO} variable, with @code{BEGINFILE} pattern
address@hidden @code{nextfile} statement, @code{BEGINFILE}/@code{ENDFILE}
patterns and
address@hidden @command{gawk} @subentry @code{ERRNO} variable in
address@hidden @code{ERRNO} variable @subentry with @code{BEGINFILE} pattern
address@hidden @code{nextfile} statement @subentry
@code{BEGINFILE}/@code{ENDFILE} patterns and
You do this by checking if the @code{ERRNO} variable is not the empty
string; if so, then @command{gawk} was not able to open the file. In
this case, your program can execute the @code{nextfile} statement
@@ -13683,13 +13683,13 @@ rule is present, the error becomes non-fatal, and
instead @code{ERRNO}
is set. This makes it possible to catch and process I/O errors at the
level of the @command{awk} program.
address@hidden @code{next} statement, @code{BEGINFILE}/@code{ENDFILE} patterns
and
address@hidden @code{next} statement @subentry @code{BEGINFILE}/@code{ENDFILE}
patterns and
The @code{next} statement (@pxref{Next Statement}) is not allowed inside
either a @code{BEGINFILE} or an @code{ENDFILE} rule. The @code{nextfile}
statement is allowed only inside a
@code{BEGINFILE} rule, not inside an @code{ENDFILE} rule.
address@hidden @code{getline} statement, @code{BEGINFILE}/@code{ENDFILE}
patterns and
address@hidden @code{getline} statement @subentry
@code{BEGINFILE}/@code{ENDFILE} patterns and
The @code{getline} statement (@pxref{Getline}) is restricted inside
both @code{BEGINFILE} and @code{ENDFILE}: only redirected
forms of @code{getline} are allowed.
@@ -13724,7 +13724,7 @@ rule to grab it before moving on to the next file.]
@subsection The Empty Pattern
@cindex empty pattern
address@hidden patterns, empty
address@hidden patterns @subentry empty
An empty (i.e., nonexistent) pattern is considered to match @emph{every}
input record. For example, the program:
@@ -13737,8 +13737,8 @@ prints the first field of every record.
@node Using Shell Variables
@section Using Shell Variables in Programs
address@hidden shells, variables
address@hidden @command{awk} programs, shell variables in
address@hidden shells @subentry variables
address@hidden @command{awk} programs @subentry shell variables in
@c @cindex shell and @command{awk} interaction
@command{awk} programs are often used as components in larger
@@ -13748,7 +13748,7 @@ hold a pattern that the @command{awk} program searches
for.
There are two ways to get the value of the shell variable
into the body of the @command{awk} program.
address@hidden shells, quoting
address@hidden shells @subentry quoting
A common method is to use shell quoting to substitute
the variable's value into the program inside the script.
For example, consider the following program:
@@ -13824,12 +13824,12 @@ in outline, an @command{awk} program generally looks
like this:
@dots{}
@end display
address@hidden @address@hidden@}} (braces), actions and
address@hidden braces (@address@hidden@}}), actions and
address@hidden separators, for statements in actions
address@hidden newlines, separating statements in actions
address@hidden @code{;} (semicolon), separating statements in actions
address@hidden semicolon (@code{;}), separating statements in actions
address@hidden @address@hidden@}} (braces) @subentry actions and
address@hidden braces (@address@hidden@}}) @subentry actions and
address@hidden separators @subentry for statements in actions
address@hidden newlines @subentry separating statements in actions
address@hidden @code{;} (semicolon) @subentry separating statements in actions
address@hidden semicolon (@code{;}) @subentry separating statements in actions
An action consists of one or more @command{awk} @dfn{statements}, enclosed
in braces (@address@hidden@address@hidden@}}). Each statement specifies one
thing to do. The statements are separated by newlines or semicolons.
@@ -13846,7 +13846,7 @@ well. An omitted action is equivalent to
@address@hidden print $0 @}}:
The following types of statements are supported in @command{awk}:
@table @asis
address@hidden side effects, statements
address@hidden side effects @subentry statements
@item Expressions
Call functions or assign values to variables
(@pxref{Expressions}). Executing
@@ -13885,21 +13885,21 @@ For deleting array elements.
@node Statements
@section Control Statements in Actions
@cindex control statements
address@hidden statements, control, in actions
address@hidden actions, control statements in
address@hidden statements @subentry control, in actions
address@hidden actions @subentry control statements in
@dfn{Control statements}, such as @code{if}, @code{while}, and so on,
control the flow of execution in @command{awk} programs. Most of
@command{awk}'s
control statements are patterned after similar statements in C.
@cindex compound address@hidden control statements and
address@hidden statements, address@hidden control statements and
address@hidden body, in actions
address@hidden @address@hidden@}} (braces), statements, grouping
address@hidden braces (@address@hidden@}}), statements, grouping
address@hidden newlines, separating statements in actions
address@hidden @code{;} (semicolon), separating statements in actions
address@hidden semicolon (@code{;}), separating statements in actions
address@hidden statements @subentry compound, control statements and
address@hidden body @subentry in actions
address@hidden @address@hidden@}} (braces) @subentry statements, grouping
address@hidden braces (@address@hidden@}}) @subentry statements, grouping
address@hidden newlines @subentry separating statements in actions
address@hidden @code{;} (semicolon) @subentry separating statements in actions
address@hidden semicolon (@code{;}) @subentry separating statements in actions
All the control statements start with special keywords, such as @code{if}
and @code{while}, to distinguish them from simple expressions.
Many control statements contain other statements. For example, the
@@ -13981,7 +13981,7 @@ the first thing on its line.
@subsection The @code{while} Statement
@cindex @code{while} statement
@cindex loops
address@hidden loops, @code{while}
address@hidden loops @subentry @code{while}
@cindex loops @address@hidden statement}
In programming, a @dfn{loop} is a part of a program that can
@@ -13995,7 +13995,7 @@ while (@var{condition})
@var{body}
@end example
address@hidden body, in loops
address@hidden body @subentry in loops
@noindent
@var{body} is a statement called the @dfn{body} of the loop,
and @var{condition} is an expression that controls how long the loop
@@ -14043,7 +14043,7 @@ program is harder to read without it.
@node Do Statement
@subsection The @address@hidden Statement
@cindex @address@hidden statement
address@hidden loops, @address@hidden
address@hidden loops @subentry @address@hidden
The @code{do} loop is a variation of the @code{while} looping statement.
The @code{do} loop executes the @var{body} once and then repeats the
@@ -14089,7 +14089,7 @@ occasionally is there a real use for a @code{do}
statement.
@node For Statement
@subsection The @code{for} Statement
@cindex @code{for} statement
address@hidden loops, @code{for}, iterative
address@hidden loops @subentry @code{for} @subentry iterative
The @code{for} statement makes it more convenient to count iterations of a
loop. The general form of the @code{for} statement looks like this:
@@ -14164,7 +14164,7 @@ while (@var{condition}) @{
@}
@end example
address@hidden loops, @code{continue} statements and
address@hidden loops @subentry @code{continue} statements and
@noindent
The only exception is when the @code{continue} statement
(@pxref{Continue Statement}) is used
@@ -14266,8 +14266,8 @@ described in @ref{Getopt Function}.)
@node Break Statement
@subsection The @code{break} Statement
@cindex @code{break} statement
address@hidden loops, exiting
address@hidden loops, @code{break} statement and
address@hidden loops @subentry exiting
address@hidden loops @subentry @code{break} statement and
The @code{break} statement jumps out of the innermost @code{for},
@code{while}, or @code{do} loop that encloses it. The following example
@@ -14328,9 +14328,9 @@ This is discussed in @ref{Switch Statement}.
@c @cindex @code{break}, outside of loops
@c @cindex historical features
@c @cindex @command{awk} language, POSIX version
address@hidden POSIX @command{awk}, @code{break} statement and
address@hidden dark corner, @code{break} statement
address@hidden @command{gawk}, @code{break} statement in
address@hidden POSIX @command{awk} @subentry @code{break} statement and
address@hidden dark corner @subentry @code{break} statement
address@hidden @command{gawk} @subentry @code{break} statement in
@cindex Brian Kernighan's @command{awk}
The @code{break} statement has no meaning when
used outside the body of a loop or @code{switch}.
@@ -14394,9 +14394,9 @@ the increment (@samp{x++}) is never reached.
@c @cindex @code{continue}, outside of loops
@c @cindex historical features
@c @cindex @command{awk} language, POSIX version
address@hidden POSIX @command{awk}, @code{continue} statement and
address@hidden dark corner, @code{continue} statement
address@hidden @command{gawk}, @code{continue} statement in
address@hidden POSIX @command{awk} @subentry @code{continue} statement and
address@hidden dark corner @subentry @code{continue} statement
address@hidden @command{gawk} @subentry @code{continue} statement in
@cindex Brian Kernighan's @command{awk}
The @code{continue} statement has no special meaning with respect to the
@code{switch} statement, nor does it have any meaning when used outside the
@@ -14429,7 +14429,7 @@ Contrast this with the effect of the @code{getline}
function
flow of control in any way (i.e., the rest of the current action executes
with a new input record).
address@hidden @command{awk} programs, execution of
address@hidden @command{awk} programs @subentry execution of
At the highest level, @command{awk} program execution is a loop that reads
an input record and then tests each rule's pattern against it. If you
think of this loop as a @code{for} statement whose body contains the
@@ -14466,11 +14466,11 @@ The @code{next} statement is not allowed inside
@code{BEGINFILE} and
@c @cindex @command{awk} language, POSIX version
@c @cindex @code{next}, inside a user-defined function
address@hidden @code{BEGIN} pattern, @code{next}/@code{nextfile} statements and
address@hidden @code{END} pattern, @code{next}/@code{nextfile} statements and
address@hidden POSIX @command{awk}, @code{next}/@code{nextfile} statements and
address@hidden @code{next} statement, user-defined functions and
address@hidden functions, user-defined, @code{next}/@code{nextfile} statements
and
address@hidden @code{BEGIN} pattern @subentry @code{next}/@code{nextfile}
statements and
address@hidden @code{END} pattern @subentry @code{next}/@code{nextfile}
statements and
address@hidden POSIX @command{awk} @subentry @code{next}/@code{nextfile}
statements and
address@hidden @code{next} statement @subentry user-defined functions and
address@hidden functions @subentry user-defined @subentry
@code{next}/@code{nextfile} statements and
According to the POSIX standard, the behavior is undefined if the
@code{next} statement is used in a @code{BEGIN} or @code{END} rule.
@command{gawk} treats it as a syntax error. Although POSIX does not disallow
it,
@@ -14533,8 +14533,8 @@ inclusion into the POSIX standard.
See @uref{http://austingroupbugs.net/view.php?id=607, the Austin Group
website}.
@end quotation
address@hidden functions, user-defined, @code{next}/@code{nextfile} statements
and
address@hidden @code{nextfile} statement, user-defined functions and
address@hidden functions @subentry user-defined @subentry
@code{next}/@code{nextfile} statements and
address@hidden @code{nextfile} statement @subentry user-defined functions and
@cindex Brian Kernighan's @command{awk}
@cindex @command{mawk} utility
The current version of BWK @command{awk} and @command{mawk}
@@ -14556,8 +14556,8 @@ is ignored. The @code{exit} statement is written as
follows:
@code{exit} address@hidden code}]
@end display
address@hidden @code{BEGIN} pattern, @code{exit} statement and
address@hidden @code{END} pattern, @code{exit} statement and
address@hidden @code{BEGIN} pattern @subentry @code{exit} statement and
address@hidden @code{END} pattern @subentry @code{exit} statement and
When an @code{exit} statement is executed from a @code{BEGIN} rule, the
program stops processing everything immediately. No input records are
read. However, if an @code{END} rule is present,
@@ -14580,7 +14580,7 @@ the @code{END} rule.
@xref{Assert Function}
for an example that does this.
address@hidden dark corner, @code{exit} statement
address@hidden dark corner @subentry @code{exit} statement
If an argument is supplied to @code{exit}, its value is used as the exit
status code for the @command{awk} process. If no argument is supplied,
@code{exit} causes @command{awk} to return a ``success'' status.
@@ -14590,7 +14590,7 @@ called a second time from an @code{END} rule with no
argument,
@command{awk} uses the previously supplied exit value. @value{DARKCORNER}
@xref{Exit Status} for more information.
address@hidden programming conventions, @code{exit} statement
address@hidden programming conventions @subentry @code{exit} statement
For example, suppose an error condition occurs that is difficult or
impossible to handle. Conventionally, programs report this by
exiting with a nonzero status. An @command{awk} program can do this
@@ -14622,7 +14622,7 @@ results across different operating systems.
@node Built-in Variables
@section Predefined Variables
@cindex predefined variables
address@hidden variables, predefined
address@hidden variables @subentry predefined
Most @command{awk} variables are available to use for your own
purposes; they never change unless your program assigns values to
@@ -14633,7 +14633,7 @@ to tell @command{awk} how to do certain things. Others
are set
automatically by @command{awk}, so that they carry information from the
internal workings of @command{awk} to your program.
address@hidden @command{gawk}, predefined variables and
address@hidden @command{gawk} @subentry predefined variables and
This @value{SECTION} documents all of @command{gawk}'s predefined variables,
most of which are also documented in the @value{CHAPTER}s describing
their areas of activity.
@@ -14648,7 +14648,7 @@ their areas of activity.
@node User-modified
@subsection Built-in Variables That Control @command{awk}
address@hidden predefined variables, user-modifiable
address@hidden predefined variables @subentry user-modifiable
@cindex user-modifiable variables
The following is an alphabetical list of variables that you can change to
@@ -14663,8 +14663,8 @@ in the description of each variable.)
@table @code
@cindex @code{BINMODE} variable
@cindex binary input/output
address@hidden input/output, binary
address@hidden differences in @command{awk} and @command{gawk}, @code{BINMODE}
variable
address@hidden input/output @subentry binary
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{BINMODE} variable
@item BINMODE #
On non-POSIX systems, this variable specifies use of binary mode
for all I/O. Numeric values of one, two, or three specify that input
@@ -14680,9 +14680,9 @@ detail in @ref{PC Using}. @command{mawk} (@pxref{Other
Versions})
also supports this variable, but only using numeric values.
@cindex @code{CONVFMT} variable
address@hidden POSIX @command{awk}, @code{CONVFMT} variable and
address@hidden numbers, converting, to strings
address@hidden strings, converting, numbers to
address@hidden POSIX @command{awk} @subentry @code{CONVFMT} variable and
address@hidden numbers @subentry converting @subentry to strings
address@hidden strings @subentry converting @subentry numbers to
@item @code{CONVFMT}
A string that controls the conversion of numbers to
strings (@pxref{Conversion}).
@@ -14692,11 +14692,11 @@ It works by being passed, in effect, as the first
argument to the
Its default value is @code{"%.6g"}.
@code{CONVFMT} was introduced by the POSIX standard.
address@hidden @command{gawk}, @code{FIELDWIDTHS} variable in
address@hidden @command{gawk} @subentry @code{FIELDWIDTHS} variable in
@cindex @code{FIELDWIDTHS} variable
address@hidden differences in @command{awk} and @command{gawk},
@code{FIELDWIDTHS} variable
address@hidden field separators, @code{FIELDWIDTHS} variable and
address@hidden separators, field, @code{FIELDWIDTHS} variable and
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{FIELDWIDTHS} variable
address@hidden field separators @subentry @code{FIELDWIDTHS} variable and
address@hidden separators @subentry field @subentry @code{FIELDWIDTHS} variable
and
@item FIELDWIDTHS #
A space-separated list of columns that tells @command{gawk}
how to split input with fixed columnar boundaries.
@@ -14707,11 +14707,11 @@ Assigning a value to @code{FIELDWIDTHS}
overrides the use of @code{FS} and @code{FPAT} for field splitting.
@xref{Constant Size} for more information.
address@hidden @command{gawk}, @code{FPAT} variable in
address@hidden @command{gawk} @subentry @code{FPAT} variable in
@cindex @code{FPAT} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{FPAT}
variable
address@hidden field separators, @code{FPAT} variable and
address@hidden separators, field, @code{FPAT} variable and
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{FPAT} variable
address@hidden field separators @subentry @code{FPAT} variable and
address@hidden separators @subentry field @subentry @code{FPAT} variable and
@item FPAT #
A regular expression (as a string) that tells @command{gawk}
to create the fields based on text that matches the regular expression.
@@ -14720,7 +14720,7 @@ overrides the use of @code{FS} and @code{FIELDWIDTHS}
for field splitting.
@xref{Splitting By Content} for more information.
@cindex @code{FS} variable
address@hidden separators, field
address@hidden separators @subentry field
@cindex field separators
@item FS
The input field separator (@pxref{Field Separators}).
@@ -14746,19 +14746,19 @@ You can set the value of @code{FS} on the command
line using the
awk -F, '@var{program}' @var{input-files}
@end example
address@hidden @command{gawk}, field separators and
address@hidden @command{gawk} @subentry field separators and
If @command{gawk} is using @code{FIELDWIDTHS} or @code{FPAT}
for field splitting,
assigning a value to @code{FS} causes @command{gawk} to return to
the normal, @code{FS}-based field splitting. An easy way to do this
is to simply say @samp{FS = FS}, perhaps with an explanatory comment.
address@hidden @command{gawk}, @code{IGNORECASE} variable in
address@hidden @command{gawk} @subentry @code{IGNORECASE} variable in
@cindex @code{IGNORECASE} variable
address@hidden differences in @command{awk} and @command{gawk},
@code{IGNORECASE} variable
address@hidden case sensitivity, string comparisons and
address@hidden case sensitivity, regexps and
address@hidden regular expressions, case sensitivity
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{IGNORECASE} variable
address@hidden case sensitivity @subentry string comparisons and
address@hidden case sensitivity @subentry regexps and
address@hidden regular expressions @subentry case sensitivity
@item IGNORECASE #
If @code{IGNORECASE} is nonzero or non-null, then all string comparisons
and all regular expression matching are case-independent.
@@ -14773,9 +14773,9 @@ and it does not affect field splitting when using a
single-character
field separator.
@xref{Case-sensitivity}.
address@hidden @command{gawk}, @code{LINT} variable in
address@hidden @command{gawk} @subentry @code{LINT} variable in
@cindex @code{LINT} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{LINT}
variable
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{LINT} variable
@cindex lint checking
@item LINT #
When this variable is true (nonzero or non-null), @command{gawk}
@@ -14797,8 +14797,8 @@ of lint warnings during program execution is
independent of the flavor
of @command{awk} being executed.
@cindex @code{OFMT} variable
address@hidden numbers, converting, to strings
address@hidden strings, converting, numbers to
address@hidden numbers @subentry converting @subentry to strings
address@hidden strings @subentry converting @subentry numbers to
@item OFMT
A string that controls conversion of numbers to
strings (@pxref{Conversion}) for
@@ -14809,9 +14809,9 @@ Its default value is @code{"%.6g"}. Earlier versions
of @command{awk}
used @code{OFMT} to specify the format for converting numbers to
strings in general expressions; this is now done by @code{CONVFMT}.
address@hidden @code{print} statement, @code{OFMT} variable and
address@hidden @code{print} statement @subentry @code{OFMT} variable and
@cindex @code{OFS} variable
address@hidden separators, field
address@hidden separators @subentry field
@cindex field separators
@item OFS
The output field separator (@pxref{Output Separators}). It is
@@ -14836,7 +14836,7 @@ numbers, by default @code{"N"} (@code{roundTiesToEven}
in
the IEEE 754 standard; @pxref{Setting the rounding mode}).
@cindex @code{RS} variable
address@hidden separators, for records
address@hidden separators @subentry for records
@cindex record separators
@item @code{RS}
The input record separator. Its default value is a string
@@ -14856,7 +14856,7 @@ or if @command{gawk} is in compatibility mode
just the first character of @code{RS}'s value is used.
@cindex @code{SUBSEP} variable
address@hidden separators, subscript
address@hidden separators @subentry subscript
@cindex subscript separators
@item @code{SUBSEP}
The subscript separator. It has the default value of
@@ -14865,10 +14865,10 @@ multidimensional array. Thus, the expression
@address@hidden"A", "B"]}}
really accesses @code{foo["A\034B"]}
(@pxref{Multidimensional}).
address@hidden @command{gawk}, @code{TEXTDOMAIN} variable in
address@hidden @command{gawk} @subentry @code{TEXTDOMAIN} variable in
@cindex @code{TEXTDOMAIN} variable
address@hidden differences in @command{awk} and @command{gawk},
@code{TEXTDOMAIN} variable
address@hidden internationalization, localization
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{TEXTDOMAIN} variable
address@hidden internationalization @subentry localization
@item TEXTDOMAIN #
Used for internationalization of programs at the
@command{awk} level. It sets the default text domain for specially
@@ -14881,8 +14881,8 @@ The default value of @code{TEXTDOMAIN} is
@code{"messages"}.
@node Auto-set
@subsection Built-in Variables That Convey Information
address@hidden predefined variables, conveying information
address@hidden variables, predefined, conveying information
address@hidden predefined variables @subentry conveying information
address@hidden variables @subentry predefined @subentry conveying information
The following is an alphabetical list of variables that @command{awk}
sets automatically on certain occasions in order to provide
information to your program.
@@ -14895,8 +14895,8 @@ mode (@pxref{Options}), they are not special:
@c @asis for docbook
@table @asis
@cindex @code{ARGC}/@code{ARGV} variables
address@hidden arguments, command-line
address@hidden command line, arguments
address@hidden arguments @subentry command-line
address@hidden command line @subentry arguments
@item @code{ARGC}, @code{ARGV}
The command-line arguments available to @command{awk} programs are stored in
an array called @code{ARGV}. @code{ARGC} is the number of command-line
@@ -14924,12 +14924,12 @@ contains @samp{inventory-shipped}, and @code{ARGV[2]}
contains
index of the last element in @code{ARGV}, because the elements are numbered
from zero.
address@hidden programming conventions, @code{ARGC}/@code{ARGV} variables
address@hidden programming conventions @subentry @code{ARGC}/@code{ARGV}
variables
The names @code{ARGC} and @code{ARGV}, as well as the convention of indexing
the array from 0 to @code{ARGC} @minus{} 1, are derived from the C language's
method of accessing command-line arguments.
address@hidden dark corner, value of @code{ARGV[0]}
address@hidden dark corner @subentry value of @code{ARGV[0]}
The value of @code{ARGV[0]} can vary from system to system.
Also, you should note that the program text is @emph{not} included in
@code{ARGV}, nor are any of @command{awk}'s command-line options.
@@ -14938,7 +14938,7 @@ about how @command{awk} uses these variables.
@value{DARKCORNER}
@cindex @code{ARGIND} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{ARGIND}
variable
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{ARGIND} variable
@item @code{ARGIND #}
The index in @code{ARGV} of the current file being processed.
Every time @command{gawk} opens a new @value{DF} for processing, it sets
@@ -14946,12 +14946,12 @@ Every time @command{gawk} opens a new @value{DF} for
processing, it sets
When @command{gawk} is processing the input files,
@samp{FILENAME == ARGV[ARGIND]} is always true.
address@hidden files, address@hidden @code{ARGIND} variable and
address@hidden files @subentry processing, @code{ARGIND} variable and
This variable is useful in file processing; it allows you to tell how far
along you are in the list of @value{DF}s as well as to distinguish between
successive instances of the same @value{FN} on the command line.
address@hidden file names, distinguishing
address@hidden file names @subentry distinguishing
While you can change the value of @code{ARGIND} within your @command{awk}
program, @command{gawk} automatically sets it to a new value when it
opens the next file.
@@ -14993,9 +14993,9 @@ On such systems, the @code{ENVIRON} array is empty
(except for
@pxref{AWKLIBPATH Variable}).
@end ifnotdocbook
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @command{gawk} @subentry @code{ERRNO} variable in
@cindex @code{ERRNO} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{ERRNO}
variable
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{ERRNO} variable
@cindex error handling, @code{ERRNO} variable and
@item @code{ERRNO #}
If a system error occurs during a redirection for @code{getline}, during
@@ -15019,7 +15019,7 @@ of @code{errno}. For non-system errors,
@code{PROCINFO["errno"]} will
be zero.
@cindex @code{FILENAME} variable
address@hidden dark corner, @code{FILENAME} variable
address@hidden dark corner @subentry @code{FILENAME} variable
@item @code{FILENAME}
The name of the current input file. When no @value{DF}s are listed
on the command line, @command{awk} reads from the standard input and
@@ -15053,8 +15053,8 @@ to @code{NF} can be used to create fields in or remove
fields from the
current record. @xref{Changing Fields}.
@cindex @code{FUNCTAB} array
address@hidden @command{gawk}, @code{FUNCTAB} array in
address@hidden differences in @command{awk} and @command{gawk}, @code{FUNCTAB}
variable
address@hidden @command{gawk} @subentry @code{FUNCTAB} array in
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{FUNCTAB} variable
@item @code{FUNCTAB #}
An array whose indices and corresponding values are the names of all
the built-in, user-defined, and extension functions in the program.
@@ -15072,9 +15072,9 @@ the beginning of the program's execution
(@pxref{Records}).
@command{awk} increments @code{NR} each time it reads a new record.
address@hidden @command{gawk}, @code{PROCINFO} array in
address@hidden @command{gawk} @subentry @code{PROCINFO} array in
@cindex @code{PROCINFO} array
address@hidden differences in @command{awk} and @command{gawk}, @code{PROCINFO}
array
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{PROCINFO} array
@item @code{PROCINFO #}
The elements of this array provide access to information about the
running @command{awk} program.
@@ -15083,7 +15083,7 @@ are guaranteed to be available:
@table @code
@item PROCINFO["argv"]
address@hidden command line, arguments
address@hidden command line @subentry arguments
The @code{PROCINFO["argv"]} array contains all of the command-line arguments
(after glob expansion and redirection processing on platforms where that must
be done manually by the program) with subscripts ranging from 0 through
@@ -15242,7 +15242,7 @@ of @command{gawk} supports dynamic loading of extension
functions
@table @code
@item PROCINFO["api_major"]
@cindex version of @command{gawk} extension API
address@hidden extension API, version number
address@hidden extension API @subentry version number
The major version of the extension API.
@item PROCINFO["api_minor"]
@@ -15314,16 +15314,16 @@ The start index in characters of the substring that
is matched by the
is the position of the string where the matched substring starts, or zero
if no match was found.
address@hidden @command{gawk}, @code{RT} variable in
address@hidden @command{gawk} @subentry @code{RT} variable in
@cindex @code{RT} variable
address@hidden differences in @command{awk} and @command{gawk},
@code{RS}/@code{RT} variables
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{RS}/@code{RT} variables
@item @code{RT #}
The input text that matched the text denoted by @code{RS},
the record separator. It is set every time a record is read.
address@hidden @command{gawk}, @code{SYMTAB} array in
address@hidden @command{gawk} @subentry @code{SYMTAB} array in
@cindex @code{SYMTAB} array
address@hidden differences in @command{awk} and @command{gawk}, @code{SYMTAB}
variable
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{SYMTAB} variable
@item @code{SYMTAB #}
An array whose indices are the names of all defined global variables and
arrays in the program. @code{SYMTAB} makes @command{gawk}'s symbol table
@@ -15402,7 +15402,7 @@ is available as an element within the @code{SYMTAB}
array.
@sidebar Changing @code{NR} and @code{FNR}
@cindex @code{NR} variable, changing
@cindex @code{FNR} variable, changing
address@hidden dark corner, @code{FNR}/@code{NR} variables
address@hidden dark corner @subentry @code{FNR}/@code{NR} variables
@command{awk} increments @code{NR} and @code{FNR}
each time it reads a record, instead of setting them to the absolute
value of the number of records read. This means that a program can
@@ -15433,9 +15433,9 @@ changed.
@node ARGC and ARGV
@subsection Using @code{ARGC} and @code{ARGV}
address@hidden @code{ARGC}/@code{ARGV} variables, how to use
address@hidden arguments, command-line
address@hidden command line, arguments
address@hidden @code{ARGC}/@code{ARGV} variables @subentry how to use
address@hidden arguments @subentry command-line
address@hidden command line @subentry arguments
@ref{Auto-set}
presented the following program describing the information contained in
@code{ARGC}
@@ -15548,7 +15548,7 @@ BEGIN @{
@}
@end example
address@hidden differences in @command{awk} and @command{gawk},
@code{ARGC}/@code{ARGV} variables
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{ARGC}/@code{ARGV} variables
Ending the @command{awk} options with @option{--} isn't
necessary in @command{gawk}. Unless @option{--posix} has
been specified, @command{gawk} silently puts any unrecognized options
@@ -15764,10 +15764,10 @@ Only the values are stored; the indices are implicit
from the order of
the values. Here, eight is the value at index zero, because eight appears in
the
position with zero elements before it.
address@hidden arrays, indexing
address@hidden arrays @subentry indexing
@cindex indexing arrays
@cindex associative arrays
address@hidden arrays, associative
address@hidden arrays @subentry associative
Arrays in @command{awk} are different---they are @dfn{associative}. This means
that each array is a collection of pairs---an index and its corresponding
array element value:
@@ -15890,7 +15890,7 @@ whose value is @address@hidden"number ten"}}. The
result is:
@noindent
@cindex sparse arrays
address@hidden arrays, sparse
address@hidden arrays @subentry sparse
Now the array is @dfn{sparse}, which just means some indices are missing.
It has elements 0--3 and 10, but doesn't have elements 4, 5, 6, 7, 8, or 9.
@@ -15958,10 +15958,10 @@ array subscripts; this is discussed in more detail in
Here, the number @code{1} isn't double-quoted, because @command{awk}
automatically converts it to a string.
address@hidden @command{gawk}, @code{IGNORECASE} variable in
address@hidden case sensitivity, array indices and
address@hidden arrays, @code{IGNORECASE} variable and
address@hidden @code{IGNORECASE} variable, array indices and
address@hidden @command{gawk} @subentry @code{IGNORECASE} variable in
address@hidden case sensitivity @subentry array indices and
address@hidden arrays @subentry @code{IGNORECASE} variable and
address@hidden @code{IGNORECASE} variable @subentry array indices and
The value of @code{IGNORECASE} has no effect upon array subscripting.
The identical string value used to store an array element must be used
to retrieve it.
@@ -15975,7 +15975,7 @@ is independent of the number of elements in the array.
@node Reference to Elements
@subsection Referring to an Array Element
address@hidden arrays, referencing elements
address@hidden arrays @subentry referencing elements
@cindex array members
@cindex elements of arrays
@@ -15997,7 +15997,7 @@ The value of the array reference is the current value
of that array
element. For example, @code{foo[4.3]} is an expression referencing the element
of array @code{foo} at index @samp{4.3}.
address@hidden arrays, unassigned elements
address@hidden arrays @subentry unassigned elements
@cindex unassigned array elements
@cindex empty array elements
A reference to an array element that has no recorded value yields a value of
@@ -16006,7 +16006,7 @@ that have not been assigned any value as well as
elements that have been
deleted (@pxref{Delete}).
@cindex non-existent array elements
address@hidden arrays, elements that don't exist
address@hidden arrays @subentry elements that don't exist
@quotation NOTE
A reference to an element that does not exist @emph{automatically} creates
that array element, with the null string as its value. (In some cases,
@@ -16027,7 +16027,7 @@ an array element equal to the empty string.
@end quotation
@c @cindex arrays, @code{in} operator and
address@hidden @code{in} operator, testing if array element exists
address@hidden @code{in} operator @subentry testing if array element exists
To determine whether an element exists in an array at a certain index, use
the following expression:
@@ -16035,7 +16035,7 @@ the following expression:
@var{indx} in @var{array}
@end example
address@hidden side effects, array indexing
address@hidden side effects @subentry array indexing
@noindent
This expression tests whether the particular index @var{indx} exists,
without the side effect of creating that element if it is not present.
@@ -16068,8 +16068,8 @@ if (frequencies[2] != "")
@node Assigning Elements
@subsection Assigning Array Elements
address@hidden arrays, elements, assigning values
address@hidden elements in arrays, assigning values
address@hidden arrays @subentry elements @subentry assigning values
address@hidden elements in arrays @subentry assigning values
Array elements can be assigned values just like
@command{awk} variables:
@@ -16086,7 +16086,7 @@ assign to that element of the array.
@node Array Example
@subsection Basic Array Example
address@hidden arrays, an example of using
address@hidden arrays @subentry an example of using
The following program takes a list of lines, each beginning with a line
number, and prints them out in order of line number. The line numbers
@@ -16161,10 +16161,10 @@ END @{
@node Scanning an Array
@subsection Scanning All Elements of an Array
address@hidden elements in arrays, scanning
address@hidden elements in arrays @subentry scanning
@cindex scanning arrays
address@hidden arrays, scanning
address@hidden loops, @code{for}, array scanning
address@hidden arrays @subentry scanning
address@hidden loops @subentry @code{for} @subentry array scanning
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
@@ -16183,11 +16183,11 @@ for (@var{var} in @var{array})
@end example
@noindent
address@hidden @code{in} operator, use in loops
address@hidden @code{in} operator @subentry use in loops
This loop executes @var{body} once for each index in @var{array} that the
program has previously used, with the variable @var{var} set to that index.
address@hidden arrays, @code{for} statement and
address@hidden arrays @subentry @code{for} statement and
@cindex @code{for} statement, looping over arrays
The following program uses this form of the @code{for} statement. The
first rule scans the input records and notes which words appear (at
@@ -16226,9 +16226,9 @@ END @{
@xref{Word Sorting}
for a more detailed example of this type.
address@hidden arrays, elements, order of access by @code{in} operator
address@hidden elements in arrays, order of access by @code{in} operator
address@hidden @code{in} operator, order of array access
address@hidden arrays @subentry elements @subentry order of access by @code{in}
operator
address@hidden elements in arrays @subentry order of access by @code{in}
operator
address@hidden @code{in} operator @subentry order of array access
The order in which elements of the array are accessed by this statement
is determined by the internal arrangement of the array elements within
@command{awk} and in standard @command{awk} cannot be controlled
@@ -16306,7 +16306,7 @@ to use for comparison of array elements. This advanced
feature
is described later in @ref{Array Sorting}.
@end itemize
address@hidden @code{PROCINFO}, values of @code{sorted_in}
address@hidden @code{PROCINFO} @subentry values of @code{sorted_in}
The following special values for @code{PROCINFO["sorted_in"]} are available:
@table @code
@@ -16441,10 +16441,10 @@ sorting arrays; see @ref{Array Sorting Functions}.
@node Numeric Array Subscripts
@section Using Numbers to Subscript Arrays
address@hidden numbers, as array subscripts
address@hidden array subscripts, numbers as
address@hidden arrays, numeric subscripts
address@hidden subscripts in arrays, numbers as
address@hidden numbers @subentry as array subscripts
address@hidden array subscripts @subentry numbers as
address@hidden arrays @subentry numeric subscripts
address@hidden subscripts in arrays @subentry numbers as
@cindex @code{CONVFMT} variable, array subscripts and
An important aspect to remember about arrays is that @emph{array subscripts
are always strings}. When a numeric value is used as a subscript,
@@ -16509,10 +16509,10 @@ effect on your programs.
@node Uninitialized Subscripts
@section Using Uninitialized Variables as Subscripts
address@hidden variables, address@hidden as array subscripts
address@hidden variables @subentry uninitialized, as array subscripts
@cindex uninitialized variables, as array subscripts
address@hidden subscripts in arrays, uninitialized variables as
address@hidden arrays, subscripts, uninitialized variables as
address@hidden subscripts in arrays @subentry uninitialized variables as
address@hidden arrays @subentry subscripts @subentry uninitialized variables as
Suppose it's necessary to write a program
to print the input data in reverse order.
A reasonable attempt to do so (with some test
@@ -16556,10 +16556,10 @@ Here, the @samp{++} forces @code{lines} to be
numeric, thus making
the ``old value'' numeric zero. This is then converted to @code{"0"}
as the array subscript.
address@hidden array subscripts, null strings as
address@hidden null strings, as array subscripts
address@hidden dark corner, array subscripts
address@hidden lint checking, array subscripts
address@hidden array subscripts @subentry null strings as
address@hidden null strings @subentry as array subscripts
address@hidden dark corner @subentry array subscripts
address@hidden lint checking @subentry array subscripts
Even though it is somewhat unusual, the null string
(@code{""}) is a valid array subscript.
@value{DARKCORNER}
@@ -16571,8 +16571,8 @@ on the command line (@pxref{Options}).
@section The @code{delete} Statement
@cindex @code{delete} statement
@cindex deleting elements in arrays
address@hidden arrays, elements, deleting
address@hidden elements in arrays, deleting
address@hidden arrays @subentry elements @subentry deleting
address@hidden elements in arrays @subentry deleting
To remove an individual element of an array, use the @code{delete}
statement:
@@ -16603,7 +16603,7 @@ if (4 in foo)
print "This will never be printed"
@end example
address@hidden null strings, deleting array elements and
address@hidden null strings @subentry deleting array elements and
It is important to note that deleting an element is @emph{not} the
same as assigning it a null value (the empty string, @code{""}).
For example:
@@ -16616,19 +16616,19 @@ if (4 in foo)
@end group
@end example
address@hidden lint checking, array elements
address@hidden lint checking @subentry array elements
It is not an error to delete an element that does not exist.
However, if @option{--lint} is provided on the command line
(@pxref{Options}),
@command{gawk} issues a warning message when an element that
is not in the array is deleted.
address@hidden common extensions, @code{delete} to delete entire arrays
address@hidden extensions, address@hidden @code{delete} to delete entire arrays
address@hidden arrays, deleting entire contents
address@hidden common extensions @subentry @code{delete} to delete entire arrays
address@hidden extensions @subentry common, @code{delete} to delete entire
arrays
address@hidden arrays @subentry deleting entire contents
@cindex deleting entire arrays
@cindex @code{delete} @var{array}
address@hidden differences in @command{awk} and @command{gawk}, array elements,
deleting
address@hidden differences in @command{awk} and @command{gawk} @subentry array
elements @subentry deleting
All the elements of an array may be deleted with a single statement
by leaving off the subscript in the @code{delete} statement,
as follows:
@@ -16654,7 +16654,7 @@ POSIX standard. See
@uref{http://austingroupbugs.net/view.php?id=544,
the Austin Group website}.
@end quotation
address@hidden portability, deleting array elements
address@hidden portability @subentry deleting array elements
@cindex Brennan, Michael
The following statement provides a portable but nonobvious way to clear
out an array:@footnote{Thanks to Michael Brennan for pointing this out.}
@@ -16689,8 +16689,8 @@ a = 3
* Multiscanning:: Scanning multidimensional arrays.
@end menu
address@hidden subscripts in arrays, multidimensional
address@hidden arrays, multidimensional
address@hidden subscripts in arrays @subentry multidimensional
address@hidden arrays @subentry multidimensional
A @dfn{multidimensional array} is an array in which an element is identified
by a sequence of indices instead of a single index. For example, a
two-dimensional array requires two indices. The usual way (in many
@@ -16730,7 +16730,7 @@ combined strings that are ambiguous. Suppose that
@code{SUBSEP} is
"b@@c"]}} are indistinguishable because both are actually
stored as @samp{foo["a@@b@@c"]}.
address@hidden @code{in} operator, index existence in multidimensional arrays
address@hidden @code{in} operator @subentry index existence in multidimensional
arrays
To test whether a particular index sequence exists in a
multidimensional array, use the same operator (@code{in}) that is
used for single-dimensional arrays. Write the whole sequence of indices
@@ -16799,8 +16799,8 @@ There is no special @code{for} statement for scanning a
multidimensional arrays or elements---there is only a
multidimensional @emph{way of accessing} an array.
address@hidden subscripts in arrays, multidimensional, scanning
address@hidden arrays, multidimensional, scanning
address@hidden subscripts in arrays @subentry multidimensional @subentry
scanning
address@hidden arrays @subentry multidimensional @subentry scanning
@cindex scanning multidimensional arrays
However, if your program has an array that is always accessed as
multidimensional, you can get the effect of scanning it by combining
@@ -17065,7 +17065,7 @@ element is itself a subarray.
@node Functions
@chapter Functions
address@hidden functions, built-in
address@hidden functions @subentry built-in
@cindex built-in functions
This @value{CHAPTER} describes @command{awk}'s built-in functions,
which fall into three categories: numeric, string, and I/O.
@@ -17119,17 +17119,17 @@ the function followed
by arguments in parentheses. For example, @samp{atan2(y + z, 1)}
is a call to the function @code{atan2()} and has two arguments.
address@hidden programming conventions, functions, calling
address@hidden whitespace, address@hidden calling
address@hidden programming conventions @subentry functions @subentry calling
address@hidden whitespace @subentry functions, calling
Whitespace is ignored between the built-in function name and the
opening parenthesis, but nonetheless it is good practice to avoid using
whitespace
there. User-defined functions do not permit whitespace in this way, and
it is easier to avoid mistakes by following a simple
convention that always works---no whitespace after a function name.
address@hidden troubleshooting, @command{gawk}, fatal address@hidden function
arguments
address@hidden @command{gawk}, function arguments and
address@hidden differences in @command{awk} and @command{gawk}, function
arguments (@command{gawk})
address@hidden troubleshooting @subentry @command{gawk} @subentry fatal errors,
function arguments
address@hidden @command{gawk} @subentry function arguments and
address@hidden differences in @command{awk} and @command{gawk} @subentry
function arguments (@command{gawk})
Each built-in function accepts a certain number of arguments.
In some cases, arguments can be omitted. The defaults for omitted
arguments vary from function to function and are described under the
@@ -17146,8 +17146,8 @@ i = 4
j = sqrt(i++)
@end example
address@hidden evaluation order, functions
address@hidden functions, built-in, evaluation order
address@hidden evaluation order @subentry functions
address@hidden functions @subentry built-in @subentry evaluation order
@cindex built-in functions, evaluation order
@noindent
the variable @code{i} is incremented to the value five before @code{sqrt()}
@@ -17239,7 +17239,7 @@ is negative.
@cindex Beebe, Nelson H.F.@:
@item @code{rand()}
@cindexawkfunc{rand}
address@hidden random numbers, @code{rand()}/@code{srand()} functions
address@hidden random numbers @subentry @code{rand()}/@code{srand()} functions
Return a random number. The values of @code{rand()} are
uniformly distributed between zero and one.
The value could be zero but is never address@hidden C version of
@@ -17285,7 +17285,7 @@ function roll(n) @{ return 1 + int(rand() * n) @}
@end example
@cindex seeding random number generator
address@hidden random numbers, seed of
address@hidden random numbers @subentry seed of
@quotation CAUTION
In most @command{awk} implementations, including @command{gawk},
@code{rand()} starts generating numbers from the same
@@ -17388,7 +17388,7 @@ pound sign (@samp{#}). They are not available in
compatibility mode
@itemx @code{asorti(address@hidden address@hidden,} @var{dest}
address@hidden,} @var{how} ] address@hidden) #}
@cindexgawkfunc{asorti}
@cindex sort array
address@hidden arrays, elements, retrieving number of
address@hidden arrays @subentry elements @subentry retrieving number of
@cindexgawkfunc{asort}
@cindex sort array indices
These two functions are similar in behavior, so they are described
@@ -17408,7 +17408,7 @@ sequential integers starting with one. If the optional
array @var{dest}
is specified, then @var{source} is duplicated into @var{dest}. @var{dest}
is then sorted, leaving the indices of @var{source} unchanged.
address@hidden @command{gawk}, @code{IGNORECASE} variable in
address@hidden @command{gawk} @subentry @code{IGNORECASE} variable in
When comparing strings, @code{IGNORECASE} affects the sorting
(@pxref{Array Sorting Functions}). If the
@var{source} array contains subarrays as values (@pxref{Arrays of
@@ -17553,7 +17553,7 @@ $ @kbd{awk 'BEGIN @{ print index("peanut", "an") @}'}
@noindent
If @var{find} is not found, @code{index()} returns zero.
address@hidden dark corner, regexp as second argument to @code{index()}
address@hidden dark corner @subentry regexp as second argument to @code{index()}
With BWK @command{awk} and @command{gawk},
it is a fatal error to use a regexp constant for @var{find}.
Other implementations allow it, simply treating the regexp
@@ -17582,12 +17582,12 @@ and 525 is then converted to the string @code{"525"},
which has
three characters.
@cindex length of input record
address@hidden input record, length of
address@hidden input record @subentry length of
If no argument is supplied, @code{length()} returns the length of @code{$0}.
@c @cindex historical features
address@hidden portability, @code{length()} function
address@hidden POSIX @command{awk}, functions and, @code{length()}
address@hidden portability @subentry @code{length()} function
address@hidden POSIX @command{awk} @subentry functions and @subentry
@code{length()}
@quotation NOTE
In older versions of @command{awk}, the @code{length()} function could
be called
@@ -17597,7 +17597,7 @@ support historical practice. For programs to be
maximally portable,
always supply the parentheses.
@end quotation
address@hidden dark corner, @code{length()} function
address@hidden dark corner @subentry @code{length()} function
If @code{length()} is called with a variable that has not been used,
@command{gawk} forces the variable to be a scalar. Other
implementations of @command{awk} leave the variable without a type.
@@ -17618,9 +17618,9 @@ If @option{--lint} has
been specified on the command line, @command{gawk} issues a
warning about this.
address@hidden common extensions, @code{length()} applied to an array
address@hidden extensions, address@hidden @code{length()} applied to an array
address@hidden differences in @command{awk} and @command{gawk}, @code{length()}
function
address@hidden common extensions @subentry @code{length()} applied to an array
address@hidden extensions @subentry common, @code{length()} applied to an array
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{length()} function
@cindex number of array elements
@cindex array, number of elements
With @command{gawk} and several other @command{awk} implementations, when
given an
@@ -17708,7 +17708,7 @@ Match of ru+n found at 12 in My program runs
Match of Melvin found at 1 in Melvin was here.
@end example
address@hidden differences in @command{awk} and @command{gawk}, @code{match()}
function
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{match()} function
If @var{array} is present, it is cleared, and then the zeroth element
of @var{array} is set to the entire portion of @var{string}
matched by @var{regexp}. If @var{regexp} contains parentheses,
@@ -17745,7 +17745,7 @@ subexpression, because they may not all have matched
text; thus, they
should be tested for with the @code{in} operator
(@pxref{Reference to Elements}).
address@hidden troubleshooting, @code{match()} function
address@hidden troubleshooting @subentry @code{match()} function
The @var{array} argument to @code{match()} is a
@command{gawk} extension. In compatibility mode
(@pxref{Options}),
@@ -17808,7 +17808,7 @@ split("cul-de-sac", a, "-", seps)
@end example
@noindent
address@hidden strings splitting, example
address@hidden strings splitting @subentry example
splits the string @code{"cul-de-sac"} into three fields using @samp{-} as the
separator. It sets the contents of the array @code{a} as follows:
@@ -17828,7 +17828,7 @@ seps[2] = "-"
@noindent
The value returned by this call to @code{split()} is three.
address@hidden differences in @command{awk} and @command{gawk}, @code{split()}
function
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{split()} function
As with input field-splitting, when the value of @var{fieldsep} is
@address@hidden" "}}, leading and trailing whitespace is ignored in values
assigned to
the elements of
@@ -17844,7 +17844,7 @@ Note, however, that @code{RS} has no effect on the way
@code{split()}
works. Even though @samp{RS = ""} causes the newline character to also be an
input
field separator, this does not affect how @code{split()} splits strings.
address@hidden dark corner, @code{split()} function
address@hidden dark corner @subentry @code{split()} function
Modern implementations of @command{awk}, including @command{gawk}, allow
the third argument to be a regexp constant
(@address@hidden/address@hidden@code{/}})
as well as a string. @value{DARKCORNER}
@@ -17981,8 +17981,8 @@ an @samp{&}:
@{ sub(/\|/, "\\&"); print @}
@end example
address@hidden @code{sub()} function, arguments of
address@hidden @code{gsub()} function, arguments of
address@hidden @code{sub()} function @subentry arguments of
address@hidden @code{gsub()} function @subentry arguments of
As mentioned, the third argument to @code{sub()} must
be a variable, field, or array element.
Some versions of @command{awk} allow the third argument to
@@ -17997,7 +17997,7 @@ sub(/USA/, "United States", "the USA and Canada")
@end example
@noindent
address@hidden troubleshooting, @code{gsub()}/@code{sub()} functions
address@hidden troubleshooting @subentry @code{gsub()}/@code{sub()} functions
For historical compatibility, @command{gawk} accepts such erroneous code.
However, using any other nonchangeable
object as the third parameter causes a fatal error and your program
@@ -18032,7 +18032,7 @@ in the string, @code{substr()} returns the null string.
Similarly, if @var{length} is present but less than or equal to zero,
the null string is returned.
address@hidden troubleshooting, @code{substr()} function
address@hidden troubleshooting @subentry @code{substr()} function
The string returned by @code{substr()} @emph{cannot} be
assigned. Thus, it is a mistake to attempt to change a portion of
a string, as shown in the following example:
@@ -18051,7 +18051,7 @@ of @code{sub()} or @code{gsub()}:
gsub(/xyz/, "pdq", substr($0, 5, 20)) # WRONG
@end example
address@hidden portability, @code{substr()} function
address@hidden portability @subentry @code{substr()} function
(Some commercial versions of @command{awk} treat
@code{substr()} as assignable, but doing so is not portable.)
@@ -18064,8 +18064,8 @@ string = "abcdef"
string = substr(string, 1, 2) "CDE" substr(string, 6)
@end example
address@hidden case sensitivity, converting case
address@hidden strings, converting letter case
address@hidden case sensitivity @subentry converting case
address@hidden strings @subentry converting letter case
@item @code{tolower(@var{string})}
@cindexawkfunc{tolower}
@cindex convert string to lower case
@@ -18084,10 +18084,10 @@ Nonalphabetic characters are left unchanged. For
example,
@end table
@sidebar Matching the Null String
address@hidden matching, null strings
address@hidden null strings, matching
address@hidden @code{*} (asterisk), @code{*} operator, null address@hidden
matching
address@hidden asterisk (@code{*}), @code{*} operator, null address@hidden
matching
address@hidden matching @subentry null strings
address@hidden null strings @subentry matching
address@hidden @code{*} (asterisk) @subentry @code{*} operator @subentry null
strings, matching
address@hidden asterisk (@code{*}) @subentry @code{*} operator @subentry null
strings, matching
In @command{awk}, the @samp{*} operator can match the null string.
This is particularly important for the @code{sub()}, @code{gsub()},
@@ -18106,14 +18106,14 @@ Although this makes a certain amount of sense, it can
be surprising.
@node Gory Details
@subsubsection More about @samp{\} and @samp{&} with @code{sub()},
@code{gsub()}, and @code{gensub()}
address@hidden escape processing, @code{gsub()}/@code{gensub()}/@code{sub()}
functions
address@hidden @code{sub()} function, escape processing
address@hidden @code{gsub()} function, escape processing
address@hidden escape processing @subentry
@code{gsub()}/@code{gensub()}/@code{sub()} functions
address@hidden @code{sub()} function @subentry escape processing
address@hidden @code{gsub()} function @subentry escape processing
@cindex @code{gensub()} function (@command{gawk}), escape processing
address@hidden @code{\} (backslash), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden backslash (@code{\}), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden @code{&} (ampersand), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden ampersand (@code{&}), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden @code{\} (backslash) @subentry
@code{gsub()}/@code{gensub()}/@code{sub()} functions and
address@hidden backslash (@code{\}) @subentry
@code{gsub()}/@code{gensub()}/@code{sub()} functions and
address@hidden @code{&} (ampersand) @subentry
@code{gsub()}/@code{gensub()}/@code{sub()} functions and
address@hidden ampersand (@code{&}) @subentry
@code{gsub()}/@code{gensub()}/@code{sub()} functions and
@quotation CAUTION
This subsubsection has been reported to cause headaches.
@@ -18279,7 +18279,7 @@ was expected. In addition, the @command{gawk}
maintainer's proposal was
lost during the standardization process. The final rules are
somewhat simpler. The results are similar except for one case.
address@hidden POSIX @command{awk}, functions and, @code{gsub()}/@code{sub()}
address@hidden POSIX @command{awk} @subentry functions and @subentry
@code{gsub()}/@code{sub()}
The POSIX rules state that @samp{\&} in the replacement string produces
a literal @samp{&}, @samp{\\} produces a literal @samp{\}, and @samp{\}
followed
by anything else is not special; the @samp{\} is placed straight into the
output.
@@ -18417,7 +18417,7 @@ Optional parameters are enclosed in square brackets ([
]):
@table @asis
@item @code{close(address@hidden address@hidden,} @address@hidden)}
@cindexawkfunc{close}
address@hidden files, closing
address@hidden files @subentry closing
@cindex close file or coprocess
Close the file @var{filename} for input or output. Alternatively, the
argument may be a shell command that was used for creating a coprocess, or
@@ -18445,8 +18445,8 @@ Flush any buffered output associated with
@var{filename}, which is either a
file opened for writing or a shell command for redirecting output to
a pipe or coprocess.
address@hidden buffers, flushing
address@hidden output, buffering
address@hidden buffers @subentry flushing
address@hidden output @subentry buffering
Many utility programs @dfn{buffer} their output (i.e., they save information
to write to a disk file or the screen in memory until there is enough
for it to be worthwhile to send the data to the output device).
@@ -18458,7 +18458,7 @@ This is the purpose of the @code{fflush()}
address@hidden also
buffers its output, and the @code{fflush()} function forces
@command{gawk} to flush its buffers.
address@hidden extensions, address@hidden @code{fflush()} function
address@hidden extensions @subentry common, @code{fflush()} function
@cindex Brian Kernighan's @command{awk}
Brian Kernighan added @code{fflush()} to his @command{awk} in April
1992. For two decades, it was a common extension. In December
@@ -18485,7 +18485,7 @@ only the standard output.
@c @cindex automatic warnings
@c @cindex warnings, automatic
address@hidden troubleshooting, @code{fflush()} function
address@hidden troubleshooting @subentry @code{fflush()} function
@code{fflush()} returns zero if the buffer is successfully flushed;
otherwise, it returns a nonzero value. (@command{gawk} returns @minus{}1.)
In the case where all buffers are flushed, the return value is zero
@@ -18501,7 +18501,7 @@ In such a case, @code{fflush()} returns @minus{}1, as
well.
@end table
@sidebar Interactive Versus Noninteractive Buffering
address@hidden buffering, interactive vs.@: noninteractive
address@hidden buffering @subentry interactive vs.@: noninteractive
As a side point, buffering issues can be even more confusing if
your program is @dfn{interactive} (i.e., communicating
@@ -18576,8 +18576,8 @@ close("/bin/sh")
@end example
@noindent
address@hidden troubleshooting, @code{system()} function
address@hidden @option{--sandbox} option, disabling @code{system()} function
address@hidden troubleshooting @subentry @code{system()} function
address@hidden @option{--sandbox} option @subentry disabling @code{system()}
function
However, if your @command{awk}
program is interactive, @code{system()} is useful for running large
self-contained programs, such as a shell or an editor.
@@ -18623,9 +18623,9 @@ As of August, 2018, BWK @command{awk} now follows
@command{gawk}'s behavior
for the return value of @code{system()}.
@sidebar Controlling Output Buffering with @code{system()}
address@hidden buffers, flushing
address@hidden buffering, input/output
address@hidden output, buffering
address@hidden buffers @subentry flushing
address@hidden buffering @subentry input/output
address@hidden output @subentry buffering
The @code{fflush()} function provides explicit control over output buffering
for
individual files and pipes. However, its use is not portable to many older
@@ -18685,9 +18685,9 @@ you would see the latter (undesirable) output.
@cindex timestamps
@cindex log files, timestamps in
address@hidden files, address@hidden timestamps in
address@hidden @command{gawk}, timestamps
address@hidden POSIX @command{awk}, timestamps and
address@hidden files @subentry log, timestamps in
address@hidden @command{gawk} @subentry timestamps
address@hidden POSIX @command{awk} @subentry timestamps and
@command{awk} programs are commonly used to process log files
containing timestamp information, indicating when a
particular log record was written. Many programs log their timestamps
@@ -18719,7 +18719,7 @@ including negative timestamps that represent times
before the
epoch.
@cindex @command{date} utility, GNU
address@hidden time, retrieving
address@hidden time @subentry retrieving
In order to make it easier to process such log files and to produce
useful reports, @command{gawk} provides the following functions for
working with timestamps. They are @command{gawk} extensions; they are
@@ -18762,7 +18762,7 @@ whether daylight savings time is in effect for the
specified time.
If @var{datespec} does not contain enough elements or if the resulting time
is out of range, @code{mktime()} returns @minus{}1.
address@hidden @command{gawk}, @code{PROCINFO} array in
address@hidden @command{gawk} @subentry @code{PROCINFO} array in
@cindex @code{PROCINFO} array
@item @code{strftime(address@hidden address@hidden,} @var{timestamp}
address@hidden,} @var{utc-flag}] ] address@hidden)}
@cindexgawkfunc{strftime}
@@ -18800,9 +18800,9 @@ log file with the current time of day. In particular,
it is easy to
determine how long ago a particular record was logged. It also allows
you to produce log records using the ``seconds since the epoch'' format.
address@hidden converting, dates to timestamps
address@hidden dates, converting to timestamps
address@hidden timestamps, converting dates to
address@hidden converting @subentry dates to timestamps
address@hidden dates @subentry converting to timestamps
address@hidden timestamps @subentry converting dates to
The @code{mktime()} function allows you to convert a textual representation
of a date and time into a timestamp. This makes it easy to do before/after
comparisons of dates and times, particularly when dealing with date and
@@ -18816,7 +18816,7 @@ in that it copies nonformat specification characters
verbatim to the
returned string, while substituting date and time values for format
specifications in the @var{format} string.
address@hidden format specifiers, @code{strftime()} function (@command{gawk})
address@hidden format specifiers @subentry @code{strftime()} function
(@command{gawk})
@code{strftime()} is guaranteed by the 1999 ISO C
address@hidden,
not every system's @code{strftime()} necessarily
@@ -19018,7 +19018,7 @@ Additionally, the alternative representations are
recognized but their
normal representations are used.
@cindex @code{date} utility, POSIX
address@hidden POSIX @command{awk}, @code{date} utility and
address@hidden POSIX @command{awk} @subentry @code{date} utility and
The following example is an @command{awk} implementation of the POSIX
@command{date} utility. Normally, the @command{date} utility prints the
current date and time of day in a well-known format. However, if you
@@ -19067,7 +19067,7 @@ gawk 'BEGIN @{
@node Bitwise Functions
@subsection Bit-Manipulation Functions
@cindex bit-manipulation functions
address@hidden bitwise, operations
address@hidden bitwise @subentry operations
@cindex AND bitwise operation
@cindex OR bitwise operation
@cindex XOR bitwise operation
@@ -19205,7 +19205,7 @@ The next operation is the @dfn{complement}; the
complement of 1 is 0 and
the complement of 0 is 1. Thus, this operation ``flips'' all the bits
of a given value.
address@hidden bitwise, shift
address@hidden bitwise @subentry shift
@cindex left shift, bitwise
@cindex right shift, bitwise
@cindex shift, bitwise
@@ -19220,7 +19220,7 @@ bits, you end up with @samp{11001000}. The following
list describes
@command{gawk}'s built-in functions that implement the bitwise operations.
Optional parameters are enclosed in square brackets ([ ]):
address@hidden @command{gawk}, bitwise operations in
address@hidden @command{gawk} @subentry bitwise operations in
@table @asis
@cindexgawkfunc{and}
@cindex bitwise AND
@@ -19337,11 +19337,11 @@ $ @kbd{gawk -f testbits.awk}
@print{} rshift(0x99, 2) = 0x26 = 00100110
@end example
address@hidden converting, strings to numbers
address@hidden strings, converting
address@hidden numbers, converting
address@hidden converting, numbers to strings
address@hidden numbers, as string of bits
address@hidden converting @subentry strings to numbers
address@hidden strings @subentry converting
address@hidden numbers @subentry converting
address@hidden converting @subentry numbers to strings
address@hidden numbers @subentry as string of bits
The @code{bits2str()} function turns a binary number into a string.
Initializing @code{mask} to one creates
a binary value where the rightmost bit
@@ -19516,11 +19516,11 @@ typed regexp.
@node I18N Functions
@subsection String-Translation Functions
address@hidden @command{gawk}, string-translation functions
address@hidden functions, string-translation
address@hidden @command{gawk} @subentry string-translation functions
address@hidden functions @subentry string-translation
@cindex string-translation functions
@cindex internationalization
address@hidden @command{awk} programs, internationalizing
address@hidden @command{awk} programs @subentry internationalizing
@command{gawk} provides facilities for internationalizing @command{awk}
programs.
These include the functions described in the following list.
@@ -19567,7 +19567,7 @@ The default value for @var{category} is
@code{"LC_MESSAGES"}.
@section User-Defined Functions
@cindex user-defined functions
address@hidden functions, user-defined
address@hidden functions @subentry user-defined
Complicated @command{awk} programs can often be simplified by defining
your own functions. User-defined functions can be called just like
built-in ones (@pxref{Function Calls}), but it is up to you to define
@@ -19591,7 +19591,7 @@ variable definitions is appallingly awful.}
@author Brian Kernighan
@end quotation
address@hidden functions, defining
address@hidden functions @subentry defining
Definitions of functions can appear anywhere between the rules of an
@command{awk} program. Thus, the general form of an @command{awk} program is
extended to include sequences of rules @emph{and} user-defined function
@@ -19611,8 +19611,8 @@ The definition of a function named @var{name} looks
like this:
@end group
@end display
address@hidden names, functions
address@hidden functions, names of
address@hidden names @subentry functions
address@hidden functions @subentry names of
@cindex namespace issues, functions
@noindent
Here, @var{name} is the name of the function to define. A valid function
@@ -19668,13 +19668,13 @@ arguments on some occasions and local variables on
others. Another
way to think of this is that omitted arguments default to the
null string.
address@hidden programming conventions, functions, writing
address@hidden programming conventions @subentry functions @subentry writing
Usually when you write a function, you know how many names you intend to
use for arguments and how many you intend to use as local variables. It is
conventional to place some extra space between the arguments and
the local variables, in order to document how your function is supposed to be
used.
address@hidden variables, shadowing
address@hidden variables @subentry shadowing
@cindex shadowing of variable values
During execution of the function body, the arguments and local variable
values hide, or @dfn{shadow}, any variables of the same names used in the
@@ -19689,7 +19689,7 @@ is executing. Once the body finishes, you can once
again access the
variables that were shadowed while the function was running.
@cindex recursive functions
address@hidden functions, recursive
address@hidden functions @subentry recursive
The function body can contain expressions that call functions. They
can even call this function, either directly or by way of another
function. When this happens, we say the function is @dfn{recursive}.
@@ -19701,11 +19701,11 @@ which is described in detail in @ref{Return
Statement}.
Many of the subsequent examples in this @value{SECTION} use
the @code{return} statement.
address@hidden common extensions, @code{func} keyword
address@hidden extensions, address@hidden @code{func} keyword
address@hidden common extensions @subentry @code{func} keyword
address@hidden extensions @subentry common, @code{func} keyword
@c @cindex @command{awk} language, POSIX version
@c @cindex POSIX @command{awk}
address@hidden POSIX @command{awk}, @code{function} keyword in
address@hidden POSIX @command{awk} @subentry @code{function} keyword in
In many @command{awk} implementations, including @command{gawk},
the keyword @code{function} may be
abbreviated @code{func}. @value{COMMONEXT}
@@ -19728,7 +19728,7 @@ syntactically valid, because functions may be used
before they are defined
in @command{awk} address@hidden program won't actually run,
because @code{foo()} is undefined.})
address@hidden portability, address@hidden defining
address@hidden portability @subentry functions, defining
To ensure that your @command{awk} programs are portable, always use the
keyword @code{function} when defining a function.
@@ -19854,7 +19854,7 @@ code could have changed @code{PROCINFO["strftime"]}.
@node Function Calling
@subsection Calling User-Defined Functions
address@hidden functions, user-defined, calling
address@hidden functions @subentry user-defined @subentry calling
@dfn{Calling a function} means causing the function to run and do its job.
A function call is an expression and its value is the value returned by
the function.
@@ -19893,7 +19893,7 @@ an error.
@subsubsection Controlling Variable Scope
@cindex local variables, in a function
address@hidden variables, local to a function
address@hidden variables @subentry local to a function
Unlike in many languages,
there is no way to make a variable local to a @address@hidden @dots{}
@address@hidden block in
@command{awk}, but you can make a variable local to a function. It is
@@ -20078,8 +20078,8 @@ cannot alter this outer value, because it is shadowed
during the
execution of @code{myfunc()} and cannot be seen or changed from there.
@cindex call by reference
address@hidden arrays, as parameters to functions
address@hidden functions, arrays as parameters to
address@hidden arrays @subentry as parameters to functions
address@hidden functions @subentry arrays as parameters to
However, when arrays are the parameters to functions, they are @emph{not}
copied. Instead, the array itself is made available for direct manipulation
by the function. This is usually termed @dfn{call by reference}.
@@ -20114,7 +20114,7 @@ prints @samp{a[1] = 1, a[2] = two, a[3] = 3}, because
@subsubsection Other Points About Calling Functions
@cindex undefined functions
address@hidden functions, undefined
address@hidden functions @subentry undefined
Some @command{awk} implementations allow you to call a function that
has not been defined. They only report a problem at runtime, when the
program actually tries to call the function. For example:
@@ -20135,12 +20135,12 @@ Because the @samp{if} statement will never be true,
it is not really a
problem that @code{foo()} has not been defined. Usually, though, it is a
problem if a program calls an undefined function.
address@hidden lint checking, undefined functions
address@hidden lint checking @subentry undefined functions
If @option{--lint} is specified
(@pxref{Options}),
@command{gawk} reports calls to undefined functions.
address@hidden portability, @code{next} statement in user-defined functions
address@hidden portability @subentry @code{next} statement in user-defined
functions
Some @command{awk} implementations generate a runtime
error if you use either the @code{next} statement
or the @code{nextfile} statement
@@ -20231,7 +20231,7 @@ function maxelt(vec, i, ret)
@}
@end example
address@hidden programming conventions, function parameters
address@hidden programming conventions @subentry function parameters
@noindent
You call @code{maxelt()} with one argument, which is an array name. The local
variables @code{i} and @code{ret} are not intended to be arguments;
@@ -20317,10 +20317,10 @@ being aware of them.
@section Indirect Function Calls
@cindex indirect function calls
address@hidden function calls, indirect
address@hidden function calls @subentry indirect
@cindex function pointers
@cindex pointers to functions
address@hidden differences in @command{awk} and @command{gawk}, indirect
function calls
address@hidden differences in @command{awk} and @command{gawk} @subentry
indirect function calls
This section describes an advanced, @command{gawk}-specific extension.
@@ -20374,7 +20374,7 @@ variable as the @emph{name} of the function to call.
@cindex @code{@@}-notation for indirect function calls
@cindex indirect function calls, @code{@@}-notation
address@hidden function calls, indirect, @code{@@}-notation for
address@hidden function calls @subentry indirect @subentry @code{@@}-notation
for
The syntax is similar to that of a regular function call: an identifier
immediately followed by an opening parenthesis, any arguments, and then
a closing parenthesis, with the addition of a leading @samp{@@}
@@ -20787,8 +20787,8 @@ It contains the following chapters:
@node Library Functions
@chapter A Library of @command{awk} Functions
@cindex libraries of @command{awk} functions
address@hidden functions, library
address@hidden functions, user-defined, library of
address@hidden functions @subentry library
address@hidden functions @subentry user-defined @subentry library of
@ref{User-defined} describes how to write
your own @command{awk} functions. Writing functions is important, because
@@ -20835,7 +20835,7 @@ and would like to contribute them to the @command{awk}
user community, see
@ref{How To Contribute}, for more information.
@end ifclear
address@hidden portability, example programs
address@hidden portability @subentry example programs
The programs in this @value{CHAPTER} and in
@ref{Sample Programs},
freely use @command{gawk}-specific features.
@@ -20855,8 +20855,8 @@ to skip any remaining input in the input file.
@item
@c 12/2000: Thanks to Nelson Beebe for pointing out the output issue.
address@hidden case sensitivity, example programs
address@hidden @code{IGNORECASE} variable, in example programs
address@hidden case sensitivity @subentry example programs
address@hidden @code{IGNORECASE} variable @subentry in example programs
Finally, some of the programs choose to ignore upper- and lowercase
distinctions in their input. They do so by assigning one to @code{IGNORECASE}.
You can achieve almost the same address@hidden effects are
@@ -20893,19 +20893,19 @@ comparisons use only lowercase letters.
@node Library Names
@section Naming Library Function Global Variables
address@hidden names, arrays/variables
address@hidden names, functions
address@hidden names @subentry arrays/variables
address@hidden names @subentry functions
@cindex namespace issues
address@hidden @command{awk} programs, documenting
address@hidden documentation, of @command{awk} programs
address@hidden @command{awk} programs @subentry documenting
address@hidden documentation @subentry of @command{awk} programs
Due to the way the @command{awk} language evolved, variables are either
@dfn{global} (usable by the entire program) or @dfn{local} (usable just by
a specific function). There is no intermediate state analogous to
@code{static} variables in C.
address@hidden variables, global, for library functions
address@hidden variables @subentry global @subentry for library functions
@cindex private variables
address@hidden variables, private
address@hidden variables @subentry private
Library functions often need to have global variables that they can use to
preserve state information between calls to the function---for example,
@code{getopt()}'s variable @code{_opti}
@@ -20919,15 +20919,15 @@ either another library function or a user's main
program. For example, a
name like @code{i} or @code{j} is not a good choice, because user programs
often use variable names like these for their own purposes.
address@hidden programming conventions, private variable names
address@hidden programming conventions @subentry private variable names
The example programs shown in this @value{CHAPTER} all start the names of their
private variables with an underscore (@samp{_}). Users generally don't use
leading underscores in their variable names, so this convention immediately
decreases the chances that the variable names will be accidentally shared
with the user's program.
address@hidden @code{_} (underscore), in names of private variables
address@hidden underscore (@code{_}), in names of private variables
address@hidden @code{_} (underscore) @subentry in names of private variables
address@hidden underscore (@code{_}) @subentry in names of private variables
In addition, several of the library functions use a prefix that helps
indicate what function or set of functions use the variables---for example,
@code{_pw_byname()} in the user database routines
@@ -20967,9 +20967,9 @@ function lib_func(x, y, l1, l2)
@}
@end example
address@hidden arrays, associative, library functions and
address@hidden libraries of @command{awk} functions, associative arrays and
address@hidden functions, library, associative arrays and
address@hidden arrays @subentry associative @subentry library functions and
address@hidden libraries of @command{awk} functions @subentry associative
arrays and
address@hidden functions @subentry library @subentry associative arrays and
@cindex Tcl
A different convention, common in the Tcl community, is to use a single
associative array to hold the values needed by the library function(s), or
@@ -21117,9 +21117,9 @@ be tested with @command{gawk} and the results compared
to the built-in
@cindex assertions
@cindex @code{assert()} function (C library)
address@hidden libraries of @command{awk} functions, assertions
address@hidden functions, library, assertions
address@hidden @command{awk} programs, lengthy, assertions
address@hidden libraries of @command{awk} functions @subentry assertions
address@hidden functions @subentry library @subentry assertions
address@hidden @command{awk} programs @subentry lengthy @subentry assertions
When writing large programs, it is often useful to know
that a condition or set of conditions is true. Before proceeding with a
particular computation, you make a statement about what you believe to be
@@ -21221,7 +21221,7 @@ If the assertion fails, you see a message similar to
the following:
mydata:1357: assertion failed: a <= 5 && b >= 17.1
@end example
address@hidden @code{END} pattern, @code{assert()} user-defined function and
address@hidden @code{END} pattern @subentry @code{assert()} user-defined
function and
There is a small problem with this version of @code{assert()}.
An @code{END} rule is automatically added
to the program calling @code{assert()}. Normally, if a program consists
@@ -21231,7 +21231,7 @@ attempts to read the input @value{DF}s or standard input
(@pxref{Using BEGIN/END}),
most likely causing the program to hang as it waits for input.
address@hidden @code{BEGIN} pattern, @code{assert()} user-defined function and
address@hidden @code{BEGIN} pattern @subentry @code{assert()} user-defined
function and
There is a simple workaround to this:
make sure that such a @code{BEGIN} rule always ends
with an @code{exit} statement.
@@ -21240,11 +21240,11 @@ with an @code{exit} statement.
@subsection Rounding Numbers
@cindex rounding numbers
address@hidden numbers, rounding
address@hidden libraries of @command{awk} functions, rounding numbers
address@hidden functions, library, rounding numbers
address@hidden @code{print} statement, @code{sprintf()} function and
address@hidden @code{printf} statement, @code{sprintf()} function and
address@hidden numbers @subentry rounding
address@hidden libraries of @command{awk} functions @subentry rounding numbers
address@hidden functions @subentry library @subentry rounding numbers
address@hidden @code{print} statement @subentry @code{sprintf()} function and
address@hidden @code{printf} statement @subentry @code{sprintf()} function and
@cindex @code{sprintf()} function, @code{print}/@code{printf} statements and
The way @code{printf} and @code{sprintf()}
(@pxref{Printf})
@@ -21306,10 +21306,10 @@ function round(x, ival, aval, fraction)
@node Cliff Random Function
@subsection The Cliff Random Number Generator
address@hidden random numbers, Cliff
address@hidden random numbers @subentry Cliff
@cindex Cliff random numbers
address@hidden numbers, Cliff random
address@hidden functions, library, Cliff random numbers
address@hidden numbers @subentry Cliff random
address@hidden functions @subentry library @subentry Cliff random numbers
The
@uref{http://mathworld.wolfram.com/CliffRandomNumberGenerator.html, Cliff
random number generator}
@@ -21352,10 +21352,10 @@ isn't random enough, you might try using this
function instead.
@node Ordinal Functions
@subsection Translating Between Characters and Numbers
address@hidden libraries of @command{awk} functions, character values as numbers
address@hidden functions, library, character values as numbers
address@hidden characters, values of as numbers
address@hidden numbers, as values of characters
address@hidden libraries of @command{awk} functions @subentry character values
as numbers
address@hidden functions @subentry library @subentry character values as numbers
address@hidden characters @subentry values of as numbers
address@hidden numbers @subentry as values of characters
One commercial implementation of @command{awk} supplies a built-in function,
@code{ord()}, which takes a character and returns the numeric value for that
character in the machine's character set. If the string passed to
@@ -21477,10 +21477,10 @@ function. It is commented out for production use.
@node Join Function
@subsection Merging an Array into a String
address@hidden libraries of @command{awk} functions, merging arrays into strings
address@hidden functions, library, merging arrays into strings
address@hidden strings, merging arrays into
address@hidden arrays, merging into strings
address@hidden libraries of @command{awk} functions @subentry merging arrays
into strings
address@hidden functions @subentry library @subentry merging arrays into strings
address@hidden strings @subentry merging arrays into
address@hidden arrays @subentry merging into strings
When doing string processing, it is often useful to be able to join
all the strings in an array into one long string. The following function,
@code{join()}, accomplishes this task. It is used later in several of
@@ -21537,10 +21537,10 @@ more difficult than they really need to be.}
@node Getlocaltime Function
@subsection Managing the Time of Day
address@hidden libraries of @command{awk} functions, managing, time
address@hidden functions, library, managing time
address@hidden timestamps, formatted
address@hidden time, managing
address@hidden libraries of @command{awk} functions @subentry managing
@subentry time
address@hidden functions @subentry library @subentry managing time
address@hidden timestamps @subentry formatted
address@hidden time @subentry managing
The @code{systime()} and @code{strftime()} functions described in
@ref{Time Functions}
provide the minimum functionality necessary for dealing with the time of day
@@ -21793,9 +21793,9 @@ function shell_quote(s, # parameter
@node Data File Management
@section @value{DDF} Management
address@hidden files, managing
address@hidden libraries of @command{awk} functions, managing, data files
address@hidden functions, library, managing data files
address@hidden files @subentry managing
address@hidden libraries of @command{awk} functions @subentry managing
@subentry data files
address@hidden functions @subentry library @subentry managing data files
This @value{SECTION} presents functions that are useful for managing
command-line @value{DF}s.
@@ -21810,8 +21810,8 @@ command-line @value{DF}s.
@node Filetrans Function
@subsection Noting @value{DDF} Boundaries
address@hidden files, managing, data file boundaries
address@hidden files, initialization and cleanup
address@hidden files @subentry managing @subentry data file boundaries
address@hidden files @subentry initialization and cleanup
The @code{BEGIN} and @code{END} rules are each executed exactly once, at
the beginning and end of your @command{awk} program, respectively
(@pxref{BEGIN/END}).
@@ -21931,7 +21931,7 @@ For more information, refer to @ref{BEGINFILE/ENDFILE}.
@node Rewind Function
@subsection Rereading the Current File
address@hidden files, reading
address@hidden files @subentry reading
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 @code{getline}
@@ -22017,9 +22017,9 @@ $ @kbd{gawk -f rewind.awk -f test.awk data }
@node File Checking
@subsection Checking for Readable @value{DDF}s
address@hidden troubleshooting, readable data files
address@hidden troubleshooting @subentry readable data files
@cindex readable data address@hidden checking
address@hidden files, skipping
address@hidden files @subentry skipping
Normally, if you give @command{awk} a @value{DF} that isn't readable,
it stops with a fatal error. There are times when you might want to
just ignore such files and keep address@hidden @code{BEGINFILE}
@@ -22057,7 +22057,7 @@ BEGIN @{
@c endfile
@end example
address@hidden troubleshooting, @code{getline} function
address@hidden troubleshooting @subentry @code{getline} function
This works, because the @code{getline} won't be fatal.
Removing the element from @code{ARGV} with @code{delete}
skips the file (because it's no longer in the list).
@@ -22135,7 +22135,7 @@ not @samp{<}.
@subsection Treating Assignments as @value{FFN}s
@cindex assignments as file names
address@hidden file names, assignments as
address@hidden file names @subentry assignments as
Occasionally, you might not want @command{awk} to process command-line
variable assignments
(@pxref{Assignment Options}).
@@ -22194,12 +22194,12 @@ are left alone.
@node Getopt Function
@section Processing Command-Line Options
address@hidden libraries of @command{awk} functions, command-line options
address@hidden functions, library, command-line options
address@hidden command-line options, processing
address@hidden options, command-line, processing
address@hidden functions, library, C library
address@hidden arguments, processing
address@hidden libraries of @command{awk} functions @subentry command-line
options
address@hidden functions @subentry library @subentry command-line options
address@hidden command-line options @subentry processing
address@hidden options @subentry command-line @subentry processing
address@hidden functions @subentry library @subentry C library
address@hidden arguments @subentry processing
Most utilities on POSIX-compatible systems take options on
the command line that can be used to change the way a program behaves.
@command{awk} is an example of such a program
@@ -22553,10 +22553,10 @@ use @code{getopt()} to process their arguments.
@node Passwd Functions
@section Reading the User Database
address@hidden libraries of @command{awk} functions, user database, reading
address@hidden functions, library, user address@hidden reading
address@hidden libraries of @command{awk} functions @subentry user database
@subentry reading
address@hidden functions @subentry library @subentry user database, reading
@cindex user address@hidden reading
address@hidden database, address@hidden reading
address@hidden database @subentry users, reading
@cindex @code{PROCINFO} array
The @code{PROCINFO} array
(@pxref{Built-in Variables})
@@ -22571,11 +22571,11 @@ for a similar suite that retrieves information from
the group database.
@cindex @code{getpwent()} function (C library)
@cindex @code{getpwent()} user-defined function
address@hidden users, information about, retrieving
address@hidden users @subentry information about @subentry retrieving
@cindex login information
@cindex account information
@cindex password file
address@hidden files, password
address@hidden files @subentry password
The POSIX standard does not define the file where user information is
kept. Instead, it provides the @code{<pwd.h>} header file
and several C language subroutines for obtaining user information.
@@ -22776,7 +22776,7 @@ function _pw_init( oldfs, oldrs, olddol0, pwcat,
using_fw, using_fpat)
@c endfile
@end example
address@hidden @code{BEGIN} pattern, @code{pwcat} program
address@hidden @code{BEGIN} pattern @subentry @code{pwcat} program
The @code{BEGIN} rule sets a private variable to the directory where
@command{pwcat} is stored. Because it is used to help out an @command{awk}
library
routine, we have chosen to put it in @file{/usr/local/libexec/awk};
@@ -22789,8 +22789,8 @@ occurrence (@code{_pw_bycount}).
The variable @code{_pw_inited} is used for efficiency, as @code{_pw_init()}
needs to be called only once.
address@hidden @code{PROCINFO} array, testing the field splitting
address@hidden @code{getline} command, @code{_pw_init()} function
address@hidden @code{PROCINFO} array @subentry testing the field splitting
address@hidden @code{getline} command @subentry @code{_pw_init()} function
Because this function uses @code{getline} to read information from
@command{pwcat}, it first saves the values of @code{FS}, @code{RS}, and
@code{$0}.
It notes in the variable @code{using_fw} whether field splitting
@@ -22906,17 +22906,17 @@ uses these functions.
@node Group Functions
@section Reading the Group Database
address@hidden libraries of @command{awk} functions, group database, reading
address@hidden functions, library, group address@hidden reading
address@hidden libraries of @command{awk} functions @subentry group database
@subentry reading
address@hidden functions @subentry library @subentry group database, reading
@cindex group database, reading
address@hidden database, address@hidden reading
address@hidden @code{PROCINFO} array, group membership and
address@hidden database, group, reading
address@hidden @code{PROCINFO} array @subentry group membership and
@cindex @code{getgrent()} function (C library)
@cindex @code{getgrent()} user-defined function
@cindex address@hidden information about
@cindex account information
@cindex group file
address@hidden files, group
address@hidden files @subentry group
Much of the discussion presented in
@ref{Passwd Functions}
applies to the group database as well. Although there has traditionally
@@ -23052,7 +23052,7 @@ $ @kbd{grcat}
Here are the functions for obtaining information from the group database.
There are several, modeled after the C library functions of the same names:
address@hidden @code{getline} command, @code{_gr_init()} user-defined function
address@hidden @code{getline} command @subentry @code{_gr_init()} user-defined
function
@cindex @code{_gr_init()} user-defined function
@example
@c file eg/lib/groupawk.in
@@ -23499,7 +23499,7 @@ output identical to that of the original version.
@node Sample Programs
@chapter Practical @command{awk} Programs
address@hidden @command{awk} programs, examples of
address@hidden @command{awk} programs @subentry examples of
@c FULLXREF ON
@ref{Library Functions},
@@ -23568,7 +23568,7 @@ cut.awk -- -c1-8 myfiles > results
@node Clones
@section Reinventing Wheels for Fun and Profit
address@hidden POSIX, address@hidden implementing in @command{awk}
address@hidden POSIX @subentry programs, implementing in @command{awk}
This @value{SECTION} presents a number of POSIX utilities implemented in
@command{awk}. Reinventing these programs in @command{awk} is often enjoyable,
@@ -23599,8 +23599,8 @@ The programs are presented in alphabetical order.
@cindex @command{cut} utility
@cindex @command{cut} utility
address@hidden fields, cutting
address@hidden columns, cutting
address@hidden fields @subentry cutting
address@hidden columns @subentry cutting
The @command{cut} utility selects, or ``cuts,'' characters or fields
from its standard input and sends them to its standard output.
Fields are separated by TABs by default,
@@ -23680,8 +23680,8 @@ function usage()
@c endfile
@end example
address@hidden @code{BEGIN} pattern, running @command{awk} programs and
address@hidden @code{FS} variable, running @command{awk} programs and
address@hidden @code{BEGIN} pattern @subentry running @command{awk} programs and
address@hidden @code{FS} variable @subentry running @command{awk} programs and
Next comes a @code{BEGIN} rule that parses the command-line options.
It sets @code{FS} to a single TAB character, because that is @command{cut}'s
default field separator. The rule then sets the output field separator to be
the
@@ -23727,7 +23727,7 @@ BEGIN @{
@c endfile
@end example
address@hidden field separators, spaces as
address@hidden field separators @subentry spaces as
The code must take
special care when the field delimiter is a space. Using
a single space (@address@hidden" "}}) for the value of @code{FS} is
@@ -23919,9 +23919,9 @@ of picking the input line apart by characters.
@node Egrep Program
@subsection Searching for Regular Expressions in Files
address@hidden regular expressions, searching for
address@hidden searching, files for regular expressions
address@hidden files, searching for regular expressions
address@hidden regular expressions @subentry searching for
address@hidden searching @subentry files for regular expressions
address@hidden files @subentry searching for regular expressions
@cindex @command{egrep} utility
The @command{egrep} utility searches files for patterns. It uses regular
expressions that are almost identical to those available in @command{awk}
@@ -24134,8 +24134,8 @@ print the @value{FN}, and then skip to the next file
with @code{nextfile}.
Finally, each line is printed, with a leading @value{FN} and colon
if necessary:
address@hidden @code{!} (exclamation point), @code{!} operator
address@hidden exclamation point (@code{!}), @code{!} operator
address@hidden @code{!} (exclamation point) @subentry @code{!} operator
address@hidden exclamation point (@code{!}) @subentry @code{!} operator
@example
@c file eg/prog/egrep.awk
@{
@@ -24195,8 +24195,8 @@ function usage()
@node Id Program
@subsection Printing Out User Information
address@hidden printing, user information
address@hidden users, information about, printing
address@hidden printing @subentry user information
address@hidden users @subentry information about @subentry printing
@cindex @command{id} utility
The @command{id} utility lists a user's real and effective user ID numbers,
real and effective group ID numbers, and the user's group set, if any.
@@ -24209,7 +24209,7 @@ $ @kbd{id}
@print{} uid=1000(arnold) gid=1000(arnold)
groups=1000(arnold),4(adm),7(lp),27(sudo)
@end example
address@hidden @code{PROCINFO} array, user and group ID numbers and
address@hidden @code{PROCINFO} array @subentry user and group ID numbers and
This information is part of what is provided by @command{gawk}'s
@code{PROCINFO} array (@pxref{Built-in Variables}).
However, the @command{id} utility provides a more palatable output than just
@@ -24336,7 +24336,7 @@ the empty string into this function saves several lines
of code.
@c FIXME: One day, update to current POSIX version of split
address@hidden files, splitting
address@hidden files @subentry splitting
@cindex @code{split} utility
The @command{split} program splits large text files into smaller pieces.
Usage is as follows:@footnote{This is the traditional usage. The
@@ -24478,8 +24478,8 @@ way as to solve the EBCDIC issue as well.
@node Tee Program
@subsection Duplicating Output into Multiple Files
address@hidden files, address@hidden duplicating output into
address@hidden output, duplicating into files
address@hidden files @subentry multiple, duplicating output into
address@hidden output @subentry duplicating into files
@cindex @code{tee} utility
The @code{tee} program is known as a ``pipe fitting.'' @code{tee} copies
its standard input to its standard output and also duplicates it to the
@@ -24602,8 +24602,8 @@ END @{
@c FIXME: One day, update to current POSIX version of uniq
address@hidden printing, unduplicated lines of text
address@hidden text, printing, unduplicated lines of
address@hidden printing @subentry unduplicated lines of text
address@hidden text @subentry printing @subentry unduplicated lines of
@cindex @command{uniq} utility
The @command{uniq} utility reads sorted lines of data on its standard
input, and by default removes duplicate lines. In other words, it only
@@ -24884,10 +24884,10 @@ suggestion.
@c FIXME: One day, update to current POSIX version of wc
@cindex counting
address@hidden input files, counting elements in
address@hidden words, counting
address@hidden characters, counting
address@hidden lines, counting
address@hidden input files @subentry counting elements in
address@hidden words @subentry counting
address@hidden characters @subentry counting
address@hidden lines @subentry counting
@cindex @command{wc} utility
The @command{wc} (word count) utility counts lines, words, and characters in
one or more input files. Its usage is as follows:
@@ -25085,8 +25085,8 @@ We hope you find them both interesting and enjoyable.
@node Dupword Program
@subsection Finding Duplicated Words in a Document
address@hidden words, address@hidden searching for
address@hidden searching, for words
address@hidden words @subentry duplicate, searching for
address@hidden searching @subentry for words
@cindex address@hidden searching
A common error when writing large amounts of prose is to accidentally
duplicate words. Typically you will see this in text as something like ``the
@@ -25187,7 +25187,7 @@ Aharon Robbins <address@hidden> wrote:
@author Erik Quanstrom
@end quotation
address@hidden time, alarm clock example program
address@hidden time @subentry alarm clock example program
@cindex alarm clock example program
The following program is a simple ``alarm clock'' program.
You give it a time of day and an optional message. At the specified time,
@@ -25343,7 +25343,7 @@ seconds are necessary:
@node Translate Program
@subsection Transliterating Characters
address@hidden characters, transliterating
address@hidden characters @subentry transliterating
@cindex @command{tr} utility
The system @command{tr} utility transliterates characters. For example, it is
often used to map uppercase letters into lowercase for further processing:
@@ -25495,7 +25495,7 @@ for inspiration.
@node Labels Program
@subsection Printing Mailing Labels
address@hidden printing, mailing labels
address@hidden printing @subentry mailing labels
@cindex mailing address@hidden printing
Here is a ``real-world''@footnote{``Real world'' is defined as
``a program actually used to get something done.''}
@@ -25627,7 +25627,7 @@ END @{
@node Word Sorting
@subsection Generating Word-Usage Counts
address@hidden words, usage address@hidden generating
address@hidden words @subentry usage counts, generating
When working with large amounts of text, it can be interesting to know
how often different words appear. For example, an author may overuse
@@ -25758,7 +25758,7 @@ to use the @command{sort} program.
@node History Sorting
@subsection Removing Duplicates from Unsorted Text
address@hidden lines, address@hidden removing
address@hidden lines @subentry duplicate, removing
The @command{uniq} program
(@pxref{Uniq Program})
removes duplicate lines from @emph{sorted} data.
@@ -25828,8 +25828,8 @@ seen.
@node Extract Program
@subsection Extracting Programs from Texinfo Source Files
address@hidden Texinfo, extracting programs from source files
address@hidden files, address@hidden extracting programs from
address@hidden Texinfo @subentry extracting programs from source files
address@hidden files @subentry Texinfo, extracting programs from
@ifnotinfo
Both this chapter and the previous chapter
(@ref{Library Functions})
@@ -26205,8 +26205,8 @@ value of @code{RT}.
@node Igawk Program
@subsection An Easy Way to Use Library Functions
address@hidden libraries of @command{awk} functions, example program for using
address@hidden functions, library, example program for using
address@hidden libraries of @command{awk} functions @subentry example program
for using
address@hidden functions @subentry library @subentry example program for using
In @ref{Include Files}, we saw how @command{gawk} provides a built-in
file-inclusion capability. However, this is a @command{gawk} extension.
This @value{SECTION} provides the motivation for making file inclusion
@@ -27038,10 +27038,10 @@ things considerably. What problem does this engender
though?
@c answer, reading from "-" or /dev/stdin
@cindex search paths
address@hidden search paths, for source files
address@hidden search paths @subentry for source files
@cindex source address@hidden search path for
address@hidden files, address@hidden search path for
address@hidden directories, searching
address@hidden files @subentry source, search path for
address@hidden directories @subentry searching
@item
As an additional example of the idea that it is not always necessary to
add new features to a program, consider the idea of having two files in
@@ -27107,8 +27107,8 @@ It contains the following chapters:
@node Advanced Features
@chapter Advanced Features of @command{gawk}
address@hidden @command{gawk}, features, advanced
address@hidden advanced features, @command{gawk}
address@hidden @command{gawk} @subentry features @subentry advanced
address@hidden advanced features @subentry @command{gawk}
@ignore
Contributed by: Peter Langston <address@hidden>
@@ -27176,9 +27176,9 @@ discusses the ability to dynamically add new built-in
functions to
@node Nondecimal Data
@section Allowing Nondecimal Input Data
@cindex @option{--non-decimal-data} option
address@hidden advanced features, nondecimal input data
address@hidden input, address@hidden nondecimal
address@hidden constants, nondecimal
address@hidden advanced features @subentry nondecimal input data
address@hidden input @subentry data, nondecimal
address@hidden constants @subentry nondecimal
If you run @command{gawk} with the @option{--non-decimal-data} option,
you can have nondecimal values in your input data:
@@ -27216,7 +27216,7 @@ Because it is common to have decimal data with leading
zeros, and because
using this facility could lead to surprising results, the default is to leave
it
disabled. If you want it, you must explicitly request it.
address@hidden programming conventions, @code{--non-decimal-data} option
address@hidden programming conventions @subentry @code{--non-decimal-data}
option
@cindex @option{--non-decimal-data} option, @code{strtonum()} function and
@cindex @code{strtonum()} function (@command{gawk}), @code{--non-decimal-data}
option and
@quotation CAUTION
@@ -27525,7 +27525,7 @@ sorted array traversal is not the default.
@node Array Sorting Functions
@subsection Sorting Array Values and Indices with @command{gawk}
address@hidden arrays, sorting
address@hidden arrays @subentry sorting
@cindexgawkfunc{asort}
@cindex @code{asort()} function (@command{gawk}), address@hidden sorting
@cindexgawkfunc{asorti}
@@ -27553,7 +27553,7 @@ The default comparison is based on the type of the
elements
All numeric values come before all string values,
which in turn come before all subarrays.
address@hidden side effects, @code{asort()} function
address@hidden side effects @subentry @code{asort()} function
An important side effect of calling @code{asort()} is that
@emph{the array's original indices are irrevocably lost}.
As this isn't always desirable, @code{asort()} accepts a
@@ -27622,9 +27622,9 @@ both arrays use the values.
@end quotation
@c Document It And Call It A Feature. Sigh.
address@hidden @command{gawk}, @code{IGNORECASE} variable in
address@hidden arrays, sorting, @code{IGNORECASE} variable and
address@hidden @code{IGNORECASE} variable, array sorting functions and
address@hidden @command{gawk} @subentry @code{IGNORECASE} variable in
address@hidden arrays @subentry sorting @subentry @code{IGNORECASE} variable and
address@hidden @code{IGNORECASE} variable @subentry array sorting functions and
Because @code{IGNORECASE} affects string comparisons, the value
of @code{IGNORECASE} also affects sorting for both @code{asort()} and
@code{asorti()}.
Note also that the locale's sorting order does @emph{not}
@@ -27723,7 +27723,7 @@ Mike Brennan
@end smallexample
@end ignore
address@hidden advanced features, address@hidden communicating with
address@hidden advanced features @subentry processes, communicating with
@cindex processes, two-way communications with
It is often useful to be able to
send data to a separate program for
@@ -27754,10 +27754,10 @@ Brennan suggests the use of @command{rand()} to
generate unique
remain more difficult to use than two-way pipes.} @c 8/2014
@cindex coprocesses
address@hidden input/output, two-way
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}), @code{|&} operator (I/O)
address@hidden @command{csh} utility, @code{|&} operator, comparison with
address@hidden input/output @subentry two-way
address@hidden @code{|} (vertical bar) @subentry @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}) @subentry @code{|&} operator (I/O)
address@hidden @command{csh} utility @subentry @code{|&} operator @subentry
comparison with
However, with @command{gawk}, it is possible to
open a @emph{two-way} pipe to another process. The second process is
termed a @dfn{coprocess}, as it runs in parallel with @command{gawk}.
@@ -27793,8 +27793,8 @@ standard error goes. It is not possible to read the
child's
standard error separately.
@cindex deadlocks
address@hidden buffering, input/output
address@hidden @code{getline} command, deadlock and
address@hidden buffering @subentry input/output
address@hidden @code{getline} command @subentry deadlock and
@item
I/O buffering may be a problem. @command{gawk} automatically
flushes all output down the pipe to the coprocess.
@@ -27805,7 +27805,7 @@ known as @dfn{deadlock}, where each process is waiting
for the
other one to do something.
@end itemize
address@hidden @code{close()} function, two-way pipes and
address@hidden @code{close()} function @subentry two-way pipes and
It is possible to close just one end of the two-way pipe to
a coprocess, by supplying a second argument to the @code{close()}
function of either @code{"to"} or @code{"from"}
@@ -27871,8 +27871,8 @@ or @code{getline}.
@xref{Nonfatal}, for more information.
@end quotation
address@hidden @command{gawk}, @code{PROCINFO} array in
address@hidden @code{PROCINFO} array, communications via ptys and
address@hidden @command{gawk} @subentry @code{PROCINFO} array in
address@hidden @code{PROCINFO} array @subentry communications via ptys and
You may also use pseudo-ttys (ptys) for
two-way communication instead of pipes, if your system supports them.
This is done on a per-command basis, by setting a special element
@@ -27959,15 +27959,15 @@ And now, magically, it works!
@node TCP/IP Networking
@section Using @command{gawk} for Network Programming
address@hidden advanced features, network programming
address@hidden networks, programming
address@hidden advanced features @subentry network programming
address@hidden networks @subentry programming
@cindex TCP/IP
@cindex @code{/inet/@dots{}} special files (@command{gawk})
address@hidden files, @code{/inet/@dots{}} (@command{gawk})
address@hidden files @subentry @code{/inet/@dots{}} (@command{gawk})
@cindex @code{/inet4/@dots{}} special files (@command{gawk})
address@hidden files, @code{/inet4/@dots{}} (@command{gawk})
address@hidden files @subentry @code{/inet4/@dots{}} (@command{gawk})
@cindex @code{/inet6/@dots{}} special files (@command{gawk})
address@hidden files, @code{/inet6/@dots{}} (@command{gawk})
address@hidden files @subentry @code{/inet6/@dots{}} (@command{gawk})
@cindex @code{EMRED}
@ifnotdocbook
@quotation
@@ -28039,7 +28039,7 @@ Again, use @samp{0} if you don't care, or else a
well-known
service name.
@end table
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @command{gawk} @subentry @code{ERRNO} variable in
@cindex @code{ERRNO} variable
@quotation NOTE
Failure in opening a two-way socket will result in a nonfatal error
@@ -28086,10 +28086,10 @@ no way to access services available over Secure
Socket Layer
@node Profiling
@section Profiling Your @command{awk} Programs
address@hidden @command{awk} programs, profiling
address@hidden @command{awk} programs @subentry profiling
@cindex profiling @command{awk} programs
@cindex @code{awkprof.out} file
address@hidden files, @code{awkprof.out}
address@hidden files @subentry @code{awkprof.out}
You may produce execution traces of your @command{awk} programs.
This is done by passing the option @option{--profile} to @command{gawk}.
@@ -28157,8 +28157,8 @@ Here is the @file{awkprof.out} that results from
running the
illustrates that @command{awk} programmers sometimes get up very early
in the morning to work):
address@hidden @code{BEGIN} pattern, profiling and
address@hidden @code{END} pattern, profiling and
address@hidden @code{BEGIN} pattern @subentry profiling and
address@hidden @code{END} pattern @subentry profiling and
@example
# gawk profile, created Mon Sep 29 05:16:21 2014
@@ -28222,7 +28222,7 @@ Multiple @code{BEGIN} and @code{END} rules retain their
separate identities, as do
multiple @code{BEGINFILE} and @code{ENDFILE} rules.
address@hidden patterns, counts, in a profile
address@hidden patterns @subentry counts @subentry in a profile
@item
Pattern--action rules have two counts.
The first count, to the left of the rule, shows how many times
@@ -28242,7 +28242,7 @@ is a count showing how many times the condition was
true.
The count for the @code{else}
indicates how many times the test failed.
address@hidden loops, count for address@hidden in a profile
address@hidden loops, count for header, in a profile
@item
The count for a loop header (such as @code{for}
or @code{while}) shows how many times the loop test was executed.
@@ -28250,8 +28250,8 @@ or @code{while}) shows how many times the loop test was
executed.
statement in a rule to determine how many times the rule was executed.
If the first statement is a loop, the count is misleading.)
address@hidden functions, user-defined, address@hidden in a profile
address@hidden user-defined, functions, address@hidden in a profile
address@hidden functions @subentry user-defined @subentry counts, in a profile
address@hidden user-defined @subentry functions @subentry counts, in a profile
@item
For user-defined functions, the count next to the @code{function}
keyword indicates how many times the function was called.
@@ -28265,8 +28265,8 @@ The layout uses ``K&R'' style with TABs.
Braces are used everywhere, even when
the body of an @code{if}, @code{else}, or loop is only a single statement.
address@hidden @code{()} (parentheses), in a profile
address@hidden parentheses @code{()}, in a profile
address@hidden @code{()} (parentheses) @subentry in a profile
address@hidden parentheses @code{()} @subentry in a profile
@item
Parentheses are used only where needed, as indicated by the structure
of the program and the precedence rules.
@@ -28322,7 +28322,7 @@ which is correct, but possibly unexpected.
@samp{print}, that distinction is retained.)
@cindex profiling @command{awk} programs, dynamically
address@hidden @command{gawk} program, dynamic profiling
address@hidden @command{gawk} program @subentry dynamic profiling
@cindex dynamic profiling
Besides creating profiles when a program has completed,
@command{gawk} can produce a profile while it is running.
@@ -28339,7 +28339,7 @@ $ @kbd{gawk --profile -f myprog &}
@cindex @command{kill} address@hidden dynamic profiling
@cindex @code{USR1} signal, for dynamic profiling
@cindex @code{SIGUSR1} signal, for dynamic profiling
address@hidden signals, @code{USR1}/@code{SIGUSR1}, for profiling
address@hidden signals @subentry @code{USR1}/@code{SIGUSR1} @subentry for
profiling
@noindent
The shell prints a job number and process ID number; in this case, 13992.
Use the @command{kill} command to send the @code{USR1} signal
@@ -28372,16 +28372,16 @@ profile file.
@cindex @code{HUP} signal, for dynamic profiling
@cindex @code{SIGHUP} signal, for dynamic profiling
address@hidden signals, @code{HUP}/@code{SIGHUP}, for profiling
address@hidden signals @subentry @code{HUP}/@code{SIGHUP} @subentry for
profiling
If you use the @code{HUP} signal instead of the @code{USR1} signal,
@command{gawk} produces the profile and the function call trace and then exits.
@cindex @code{INT} signal (MS-Windows)
@cindex @code{SIGINT} signal (MS-Windows)
address@hidden signals, @code{INT}/@code{SIGINT} (MS-Windows)
address@hidden signals @subentry @code{INT}/@code{SIGINT} (MS-Windows)
@cindex @code{QUIT} signal (MS-Windows)
@cindex @code{SIGQUIT} signal (MS-Windows)
address@hidden signals, @code{QUIT}/@code{SIGQUIT} (MS-Windows)
address@hidden signals @subentry @code{QUIT}/@code{SIGQUIT} (MS-Windows)
When @command{gawk} runs on MS-Windows systems, it uses the
@code{INT} and @code{QUIT} signals for producing the profile, and in
the case of the @code{INT} signal, @command{gawk} exits. This is
@@ -28401,8 +28401,8 @@ Once upon a time, the @option{--pretty-print} option
would also run
your program. This is is no longer the case.
@end quotation
address@hidden profiling, address@hidden difference with
address@hidden pretty-printing, address@hidden difference with
address@hidden profiling, pretty-printing, difference with
address@hidden pretty-printing, profiling, difference with
There is a significant difference between the output created when
profiling, and that created when pretty-printing. Pretty-printed output
preserves the original comments that were in the program, although their
@@ -28486,9 +28486,9 @@ countries, they were able to sell more systems.
As a result, internationalization and localization
of programs and software systems became a common practice.
address@hidden internationalization, localization
address@hidden internationalization @subentry localization
@cindex @command{gawk}, internationalization and
@seeentry{internationalization}
address@hidden internationalization, localization, @command{gawk} and
address@hidden internationalization @subentry localization @subentry
@command{gawk} and
For many years, the ability to provide internationalization
was largely restricted to programs written in C and C++.
This @value{CHAPTER} describes the underlying library @command{gawk}
@@ -28540,7 +28540,7 @@ port doesn't support GNU @command{gettext}.
Therefore, these features are not available
if you are using one of those operating systems. Sorry.}
address@hidden portability, @command{gettext} library and
address@hidden portability @subentry @command{gettext} library and
When using GNU @command{gettext}, each application has its own
@dfn{text domain}. This is a unique name, such as @samp{kpilot} or
@samp{gawk},
that identifies the application.
@@ -28568,9 +28568,9 @@ The programmer indicates the application's text domain
by calling the @code{textdomain()} function.
@cindex @code{.pot} files
address@hidden files, @code{.pot}
address@hidden files @subentry @code{.pot}
@cindex portable object template files
address@hidden files, portable object template
address@hidden files @subentry portable object template
@item
Messages from the application are extracted from the source code and
collected into a portable object template file (@file{guide.pot}),
@@ -28580,9 +28580,9 @@ The original (usually English) messages serve as the
key for
lookup of the translations.
@cindex @code{.po} files
address@hidden files, @code{.po}
address@hidden files @subentry @code{.po}
@cindex portable object files
address@hidden files, portable object
address@hidden files @subentry portable object
@item
For each language with a translator, @file{guide.pot}
is copied to a portable object file (@code{.po})
@@ -28590,9 +28590,9 @@ and translations are created and shipped with the
application.
For example, there might be a @file{fr.po} for a French translation.
@cindex @code{.gmo} files
address@hidden files, @code{.gmo}
address@hidden files @subentry @code{.gmo}
@cindex message object files
address@hidden files, message object
address@hidden files @subentry message object
@item
Each language's @file{.po} file is converted into a binary
message object (@file{.gmo}) file.
@@ -28610,10 +28610,10 @@ For testing and development, it is possible to tell
@command{gettext}
to use @file{.gmo} files in a different directory than the standard
one by using the @code{bindtextdomain()} function.
address@hidden @code{.gmo} files, specifying directory of
address@hidden files, @code{.gmo}, specifying directory of
address@hidden message object files, specifying directory of
address@hidden files, message object, specifying directory of
address@hidden @code{.gmo} files @subentry specifying directory of
address@hidden files @subentry @code{.gmo} @subentry specifying directory of
address@hidden message object files @subentry specifying directory of
address@hidden files @subentry message object @subentry specifying directory of
@item
At runtime, @command{guide} looks up each string via a call
to @code{gettext()}. The returned string is the translated string
@@ -28637,8 +28637,8 @@ printf("%s", gettext("Don't Panic!\n"));
The tools that extract messages from source code pull out all
strings enclosed in calls to @code{gettext()}.
address@hidden @code{_} (underscore), C macro
address@hidden underscore (@code{_}), C macro
address@hidden @code{_} (underscore) @subentry C macro
address@hidden underscore (@code{_}) @subentry C macro
The GNU @command{gettext} developers, recognizing that typing
@samp{gettext(@dots{})} over and over again is both painful and ugly to look
at, use the macro @samp{_} (an underscore) to make things easier:
@@ -28651,7 +28651,7 @@ at, use the macro @samp{_} (an underscore) to make
things easier:
printf("%s", _("Don't Panic!\n"));
@end example
address@hidden internationalization, localization, locale categories
address@hidden internationalization @subentry localization @subentry locale
categories
@cindex @command{gettext} library, locale categories
@cindex locale categories
@noindent
@@ -28694,7 +28694,7 @@ such as @code{/[[:alnum:]]/}
(@pxref{Bracket Expressions}).
@cindex monetary information, localization
address@hidden currency symbols, localization
address@hidden currency symbols @subentry localization
@cindex @code{LC_MONETARY} locale category
@item LC_MONETARY
Monetary information, such as the currency symbol, and whether the
@@ -28708,8 +28708,8 @@ use a comma every three decimal places and a period for
the decimal
point, while many Europeans do exactly the opposite:
1,234.56 versus 1.234,56.}
address@hidden time, localization and
address@hidden dates, information related address@hidden localization
address@hidden time @subentry localization and
address@hidden dates @subentry information related to, localization
@cindex @code{LC_TIME} locale category
@item LC_TIME
Time- and date-related information, such as 12- or 24-hour clock, month printed
@@ -28742,7 +28742,7 @@ for the C @code{bindtextdomain()} function and also see
@node Programmer i18n
@section Internationalizing @command{awk} Programs
address@hidden @command{awk} programs, internationalizing
address@hidden @command{awk} programs @subentry internationalizing
@command{gawk} provides the following variables for
internationalization:
@@ -28754,8 +28754,8 @@ This variable indicates the application's text domain.
For compatibility with GNU @command{gettext}, the default
value is @code{"messages"}.
address@hidden internationalization, localization, marked strings
address@hidden strings, for localization
address@hidden internationalization @subentry localization @subentry marked
strings
address@hidden strings @subentry for localization
@item _"your message here"
String constants marked with a leading underscore
are candidates for translation at runtime.
@@ -28804,10 +28804,10 @@ The default value for @var{category} is
@code{"LC_MESSAGES"}.
The same remarks about argument order as for the @code{dcgettext()} function
apply.
address@hidden @code{.gmo} files, specifying directory of
address@hidden files, @code{.gmo}, specifying directory of
address@hidden message object files, specifying directory of
address@hidden files, message object, specifying directory of
address@hidden @code{.gmo} files @subentry specifying directory of
address@hidden files @subentry @code{.gmo} @subentry specifying directory of
address@hidden message object files @subentry specifying directory of
address@hidden files @subentry message object @subentry specifying directory of
@cindexgawkfunc{bindtextdomain}
@item @code{bindtextdomain(@var{directory}} address@hidden,} @var{domain}
address@hidden)}
Change the directory in which
@@ -28825,8 +28825,8 @@ given @var{domain}.
To use these facilities in your @command{awk} program, follow these steps:
@enumerate
address@hidden @code{BEGIN} pattern, @code{TEXTDOMAIN} variable and
address@hidden @code{TEXTDOMAIN} variable, @code{BEGIN} pattern and
address@hidden @code{BEGIN} pattern @subentry @code{TEXTDOMAIN} variable and
address@hidden @code{TEXTDOMAIN} variable @subentry @code{BEGIN} pattern and
@item
Set the variable @code{TEXTDOMAIN} to the text domain of
your program. This is best done in a @code{BEGIN} rule
@@ -28841,8 +28841,8 @@ BEGIN @{
@}
@end example
address@hidden @code{_} (underscore), translatable string
address@hidden underscore (@code{_}), translatable string
address@hidden @code{_} (underscore) @subentry translatable string
address@hidden underscore (@code{_}) @subentry translatable string
@item
Mark all translatable strings with a leading underscore (@samp{_})
character. It @emph{must} be adjacent to the opening
@@ -28917,9 +28917,9 @@ and use translations from @command{awk}.
@section Translating @command{awk} Programs
@cindex @code{.po} files
address@hidden files, @code{.po}
address@hidden files @subentry @code{.po}
@cindex portable object files
address@hidden files, portable object
address@hidden files @subentry portable object
Once a program's translatable strings have been marked, they must
be extracted to create the initial @file{.pot} file.
As part of translation, it is often helpful to rearrange the order
@@ -28939,9 +28939,9 @@ is covered.
@node String Extraction
@subsection Extracting Marked Strings
address@hidden strings, extracting
address@hidden strings @subentry extracting
@cindex @option{--gen-pot} option
address@hidden command-line options, string extraction
address@hidden command-line options @subentry string extraction
@cindex string extraction (internationalization)
@cindex marked string extraction (internationalization)
@cindex extraction, of marked strings (internationalization)
@@ -28976,8 +28976,8 @@ translations for @command{guide}.
@node Printf Ordering
@subsection Rearranging @code{printf} Arguments
address@hidden @code{printf} statement, positional specifiers
address@hidden positional specifiers, @code{printf} statement
address@hidden @code{printf} statement @subentry positional specifiers
address@hidden positional specifiers @subentry @code{printf} statement
Format strings for @code{printf} and @code{sprintf()}
(@pxref{Printf})
present a special problem for translation.
@@ -29044,9 +29044,9 @@ comes first, then the integer position, and then the
@samp{$}.
This is somewhat counterintuitive.
@end quotation
address@hidden @code{printf} statement, positional specifiers, mixing with
regular formats
address@hidden positional specifiers, @code{printf} statement, mixing with
regular formats
address@hidden format specifiers, mixing regular with positional specifiers
address@hidden @code{printf} statement @subentry positional specifiers
@subentry mixing with regular formats
address@hidden positional specifiers @subentry @code{printf} statement
@subentry mixing with regular formats
address@hidden format specifiers @subentry mixing regular with positional
specifiers
@command{gawk} does not allow you to mix regular format specifiers
and those with positional specifiers in the same string:
@@ -29072,8 +29072,8 @@ is first written.
@node I18N Portability
@subsection @command{awk} Portability Issues
address@hidden portability, internationalization and
address@hidden internationalization, localization, portability and
address@hidden portability @subentry internationalization and
address@hidden internationalization @subentry localization @subentry
portability and
@command{gawk}'s internationalization features were purposely chosen to
have as little impact as possible on the portability of @command{awk}
programs that use them to other versions of @command{awk}.
@@ -29094,7 +29094,7 @@ However, it is actually almost portable, requiring very
little
change:
@itemize @value{BULLET}
address@hidden @code{TEXTDOMAIN} variable, portability and
address@hidden @code{TEXTDOMAIN} variable @subentry portability and
@item
Assignments to @code{TEXTDOMAIN} won't have any effect,
because @code{TEXTDOMAIN} is not special in other @command{awk}
implementations.
@@ -29262,14 +29262,14 @@ We next make the directories:
$ @kbd{mkdir en_US.UTF-8 en_US.UTF-8/LC_MESSAGES}
@end example
address@hidden @code{.po} files, converting to @code{.mo}
address@hidden files, @code{.po}, converting to @code{.mo}
address@hidden @code{.po} files @subentry converting to @code{.mo}
address@hidden files @subentry @code{.po} @subentry converting to @code{.mo}
@cindex @code{.mo} files, converting from @code{.po}
address@hidden files, @code{.mo}, converting from @code{.po}
address@hidden portable object files, converting to message object files
address@hidden files, portable object, converting to message object files
address@hidden message object files, converting from portable object files
address@hidden files, message object, converting from portable object files
address@hidden files @subentry @code{.mo} @subentry converting from @code{.po}
address@hidden portable object files @subentry converting to message object
files
address@hidden files @subentry portable object @subentry converting to message
object files
address@hidden message object files @subentry converting from portable object
files
address@hidden files @subentry message object @subentry converting from
portable object files
@cindex @command{msgfmt} utility
The @command{msgfmt} utility converts the human-readable
@file{.po} file into a machine-readable @file{.mo} file.
@@ -29447,7 +29447,7 @@ functional program that you or someone else wrote).
@node Debugging Terms
@subsection Debugging Concepts
address@hidden debugger, concepts
address@hidden debugger @subentry concepts
Before diving in to the details, we need to introduce several
important concepts that apply to just about all debuggers.
The following list defines terms used throughout the rest of
@@ -29523,7 +29523,7 @@ does not work at the level of machine instructions.}
@section Sample @command{gawk} Debugging Session
@cindex sample debugging session
@cindex example debugging session
address@hidden debugging, example session
address@hidden debugging @subentry example session
In order to illustrate the use of @command{gawk} as a debugger, let's look at
a sample
debugging session. We will use the @command{awk} implementation of the
@@ -29538,7 +29538,7 @@ as our example.
@node Debugger Invocation
@subsection How to Start the Debugger
@cindex starting the debugger
address@hidden debugger, how to start
address@hidden debugger @subentry how to start
Starting the debugger is almost exactly like running @command{gawk} normally,
except you have to pass an additional option, @option{--debug}, or the
@@ -29561,7 +29561,7 @@ in the command line to the debugger rather than as part
of the @code{run}
command at the debugger prompt.)
The @option{-1} is an option to @file{uniq.awk}.
address@hidden debugger, prompt
address@hidden debugger @subentry prompt
Instead of immediately running the program on @file{inputfile}, as
@command{gawk} would ordinarily do, the debugger merely loads all
the program source files, compiles them internally, and then gives
@@ -29611,10 +29611,10 @@ a breakpoint in @file{uniq.awk} is at the beginning
of the function
@code{are_equal()}, which compares the current line with the previous one. To
set
the breakpoint, use the @code{b} (breakpoint) command:
address@hidden debugger, setting a breakpoint
address@hidden debugger, @code{breakpoint} command
address@hidden debugger, @code{break} command
address@hidden debugger, @code{b} command
address@hidden debugger @subentry setting a breakpoint
address@hidden debugger @subentry @code{breakpoint} command
address@hidden debugger @subentry @code{break} command
address@hidden debugger @subentry @code{b} command
@example
gawk> @kbd{b are_equal}
@print{} Breakpoint 1 set at file `awklib/eg/prog/uniq.awk', line 63
@@ -29624,8 +29624,8 @@ The debugger tells us the file and line number where
the breakpoint is.
Now type @samp{r} or @samp{run} and the program runs until it hits
the breakpoint for the first time:
address@hidden debugger, running the program
address@hidden debugger, @code{run} command
address@hidden debugger @subentry running the program
address@hidden debugger @subentry @code{run} command
@example
gawk> @kbd{r}
@print{} Starting program:
@@ -29641,9 +29641,9 @@ let's see how we got to where we are. At the prompt,
we type @samp{bt}
(short for ``backtrace''), and the debugger responds with a
listing of the current stack frames:
address@hidden debugger, stack frames, showing
address@hidden debugger, @code{bt} command
address@hidden debugger, @code{backtrace} command
address@hidden debugger @subentry stack frames @subentry showing
address@hidden debugger @subentry @code{bt} command
address@hidden debugger @subentry @code{backtrace} command
@example
gawk> @kbd{bt}
@print{} #0 are_equal(n, m, clast, cline, alast, aline)
@@ -29663,8 +29663,8 @@ of some variables. Let's say we type @samp{p n}
@code{n}, a parameter to @code{are_equal()}. Actually, the debugger
gives us:
address@hidden debugger, @code{print} command
address@hidden debugger, @code{p} command
address@hidden debugger @subentry @code{print} command
address@hidden debugger @subentry @code{p} command
@example
gawk> @kbd{p n}
@print{} n = untyped variable
@@ -29715,8 +29715,8 @@ be inside this function. To investigate further, we
must begin
``stepping through'' the lines of @code{are_equal()}. We start by typing
@samp{n} (for ``next''):
address@hidden debugger, @code{n} command
address@hidden debugger, @code{next} command
address@hidden debugger @subentry @code{n} command
address@hidden debugger @subentry @code{next} command
@example
@group
gawk> @kbd{n}
@@ -29762,7 +29762,7 @@ This information is useful enough (we now know that
none of the words were accidentally left out), but what if we want to see
inside the array?
address@hidden debugger, printing single array elements
address@hidden debugger @subentry printing single array elements
The first choice would be to use subscripts:
@example
@@ -29782,7 +29782,7 @@ This would be kind of slow for a 100-member array,
though, so
@command{gawk} provides a shortcut (reminiscent of another language
not to be mentioned):
address@hidden debugger, printing all array elements
address@hidden debugger @subentry printing all array elements
@example
gawk> @kbd{p @@alast}
@print{} alast["1"] = "awk"
@@ -29862,7 +29862,7 @@ Getting information
Miscellaneous
@end itemize
address@hidden debugger, repeating commands
address@hidden debugger @subentry repeating commands
Each of these are discussed in the following subsections.
In the following descriptions, commands that may be abbreviated
show the abbreviation on a second description line.
@@ -29892,12 +29892,12 @@ will otherwise just run as if it was not under the
debugger. The commands for
controlling breakpoints are:
@table @asis
address@hidden debugger commands, @code{b} (@code{break})
address@hidden debugger commands, @code{break}
address@hidden debugger commands @subentry @code{b} (@code{break})
address@hidden debugger commands @subentry @code{break}
@cindex @code{break} debugger command
@cindex @code{b} debugger command (alias for @code{break})
@cindex set breakpoint
address@hidden breakpoint, setting
address@hidden breakpoint @subentry setting
@item @code{break} address@hidden@code{:address@hidden | @var{function}]
address@hidden"@var{expression}"}]
@itemx @code{b} address@hidden@code{:address@hidden | @var{function}]
address@hidden"@var{expression}"}]
Without any argument, set a breakpoint at the next instruction
@@ -29927,9 +29927,9 @@ evaluates whenever the breakpoint is reached. If the
condition is true,
then the debugger stops execution and prompts for a command. Otherwise,
it continues executing the program.
address@hidden debugger commands, @code{clear}
address@hidden debugger commands @subentry @code{clear}
@cindex @code{clear} debugger command
address@hidden delete breakpoint, at location
address@hidden delete breakpoint @subentry at location
@cindex breakpoint at location, how to delete
@item @code{clear} address@hidden@code{:address@hidden | @var{function}]
Without any argument, delete any breakpoint at the next instruction
@@ -29949,7 +29949,7 @@ Delete breakpoint(s) set at line number @var{n} in
source file @var{filename}.
Delete breakpoint(s) set at entry to function @var{function}.
@end table
address@hidden debugger commands, @code{condition}
address@hidden debugger commands @subentry @code{condition}
@cindex @code{condition} debugger command
@cindex breakpoint condition
@item @code{condition} @var{n} @code{"@var{expression}"}
@@ -29962,27 +29962,27 @@ the debugger continues executing the program. If the
condition expression is
not specified, any existing condition is removed (i.e., the breakpoint or
watchpoint is made unconditional).
address@hidden debugger commands, @code{d} (@code{delete})
address@hidden debugger commands, @code{delete}
address@hidden debugger commands @subentry @code{d} (@code{delete})
address@hidden debugger commands @subentry @code{delete}
@cindex @code{delete} debugger command
@cindex @code{d} debugger command (alias for @code{delete})
address@hidden delete breakpoint, by number
address@hidden breakpoint, delete by number
address@hidden delete breakpoint @subentry by number
address@hidden breakpoint @subentry delete by number
@item @code{delete} address@hidden n2} @dots{}] address@hidden@var{m}]
@itemx @code{d} address@hidden n2} @dots{}] address@hidden@var{m}]
Delete specified breakpoints or a range of breakpoints. Delete
all defined breakpoints if no argument is supplied.
address@hidden debugger commands, @code{disable}
address@hidden debugger commands @subentry @code{disable}
@cindex @code{disable} debugger command
@cindex disable breakpoint
address@hidden breakpoint, how to disable or enable
address@hidden breakpoint @subentry how to disable or enable
@item @code{disable} address@hidden n2} @dots{} | @address@hidden
Disable specified breakpoints or a range of breakpoints. Without
any argument, disable all breakpoints.
address@hidden debugger commands, @code{e} (@code{enable})
address@hidden debugger commands, @code{enable}
address@hidden debugger commands @subentry @code{e} (@code{enable})
address@hidden debugger commands @subentry @code{enable}
@cindex @code{enable} debugger command
@cindex @code{e} debugger command (alias for @code{enable})
@cindex enable breakpoint
@@ -30003,15 +30003,15 @@ Enable the breakpoints temporarily, then disable each
one when
the program stops at it.
@end table
address@hidden debugger commands, @code{ignore}
address@hidden debugger commands @subentry @code{ignore}
@cindex @code{ignore} debugger command
@cindex ignore breakpoint
@item @code{ignore} @var{n} @var{count}
Ignore breakpoint number @var{n} the next @var{count} times it is
hit.
address@hidden debugger commands, @code{t} (@code{tbreak})
address@hidden debugger commands, @code{tbreak}
address@hidden debugger commands @subentry @code{t} (@code{tbreak})
address@hidden debugger commands @subentry @code{tbreak}
@cindex @code{tbreak} debugger command
@cindex @code{t} debugger command (alias for @code{tbreak})
@cindex temporary breakpoint
@@ -30029,11 +30029,11 @@ and observing its behavior. There are more commands
for controlling
execution of the program than we saw in our earlier example:
@table @asis
address@hidden debugger commands, @code{commands}
address@hidden debugger commands @subentry @code{commands}
@cindex @code{commands} debugger command
address@hidden debugger commands, @code{silent}
address@hidden debugger commands @subentry @code{silent}
@cindex @code{silent} debugger command
address@hidden debugger commands, @code{end}
address@hidden debugger commands @subentry @code{end}
@cindex @code{end} debugger command
@cindex breakpoint commands
@cindex commands to execute at breakpoint
@@ -30062,8 +30062,8 @@ gawk> @kbd{commands}
gawk>
@end example
address@hidden debugger commands, @code{c} (@code{continue})
address@hidden debugger commands, @code{continue}
address@hidden debugger commands @subentry @code{c} (@code{continue})
address@hidden debugger commands @subentry @code{continue}
@cindex continue program, in debugger
@cindex @code{continue} debugger command
@item @code{continue} address@hidden
@@ -30072,14 +30072,14 @@ Resume program execution. If continued from a
breakpoint and @var{count} is
specified, ignore the breakpoint at that location the next @var{count} times
before stopping.
address@hidden debugger commands, @code{finish}
address@hidden debugger commands @subentry @code{finish}
@cindex @code{finish} debugger command
@item @code{finish}
Execute until the selected stack frame returns.
Print the returned value.
address@hidden debugger commands, @code{n} (@code{next})
address@hidden debugger commands, @code{next}
address@hidden debugger commands @subentry @code{n} (@code{next})
address@hidden debugger commands @subentry @code{next}
@cindex @code{next} debugger command
@cindex @code{n} debugger command (alias for @code{next})
@cindex single-step execution, in the debugger
@@ -30089,15 +30089,15 @@ Continue execution to the next source line, stepping
over function calls.
The argument @var{count} controls how many times to repeat the action, as
in @code{step}.
address@hidden debugger commands, @code{ni} (@code{nexti})
address@hidden debugger commands, @code{nexti}
address@hidden debugger commands @subentry @code{ni} (@code{nexti})
address@hidden debugger commands @subentry @code{nexti}
@cindex @code{nexti} debugger command
@cindex @code{ni} debugger command (alias for @code{nexti})
@item @code{nexti} address@hidden
@itemx @code{ni} address@hidden
Execute one (or @var{count}) instruction(s), stepping over function calls.
address@hidden debugger commands, @code{return}
address@hidden debugger commands @subentry @code{return}
@cindex @code{return} debugger command
@item @code{return} address@hidden
Cancel execution of a function call. If @var{value} (either a string or a
@@ -30106,8 +30106,8 @@ frame other than the innermost one (the currently
executing function; i.e.,
frame number 0), discard all inner frames in addition to the selected one,
and the caller of that frame becomes the innermost frame.
address@hidden debugger commands, @code{r} (@code{run})
address@hidden debugger commands, @code{run}
address@hidden debugger commands @subentry @code{r} (@code{run})
address@hidden debugger commands @subentry @code{run}
@cindex @code{run} debugger command
@cindex @code{r} debugger command (alias for @code{run})
@item @code{run}
@@ -30116,8 +30116,8 @@ Start/restart execution of the program. When
restarting, the debugger
retains the current breakpoints, watchpoints, command history,
automatic display variables, and debugger options.
address@hidden debugger commands, @code{s} (@code{step})
address@hidden debugger commands, @code{step}
address@hidden debugger commands @subentry @code{s} (@code{step})
address@hidden debugger commands @subentry @code{step}
@cindex @code{step} debugger command
@cindex @code{s} debugger command (alias for @code{step})
@item @code{step} address@hidden
@@ -30127,8 +30127,8 @@ current stack frame, stepping inside any function
called within
the line. If the argument @var{count} is supplied, steps that many times
before
stopping, unless it encounters a breakpoint or watchpoint.
address@hidden debugger commands, @code{si} (@code{stepi})
address@hidden debugger commands, @code{stepi}
address@hidden debugger commands @subentry @code{si} (@code{stepi})
address@hidden debugger commands @subentry @code{stepi}
@cindex @code{stepi} debugger command
@cindex @code{si} debugger command (alias for @code{stepi})
@item @code{stepi} address@hidden
@@ -30137,8 +30137,8 @@ Execute one (or @var{count}) instruction(s), stepping
inside function calls.
(For illustration of what is meant by an ``instruction'' in @command{gawk},
see the output shown under @code{dump} in @ref{Miscellaneous Debugger
Commands}.)
address@hidden debugger commands, @code{u} (@code{until})
address@hidden debugger commands, @code{until}
address@hidden debugger commands @subentry @code{u} (@code{until})
address@hidden debugger commands @subentry @code{until}
@cindex @code{until} debugger command
@cindex @code{u} debugger command (alias for @code{until})
@item @code{until} address@hidden@code{:address@hidden | @var{function}]
@@ -30155,7 +30155,7 @@ stack frame returns.
The commands for viewing and changing variables inside of @command{gawk} are:
@table @asis
address@hidden debugger commands, @code{display}
address@hidden debugger commands @subentry @code{display}
@cindex @code{display} debugger command
@item @code{display} address@hidden | @address@hidden
Add variable @var{var} (or field @address@hidden) to the display list.
@@ -30175,7 +30175,7 @@ no such variable of the given name exists.
Without argument, @code{display} displays the current values of
items on the list.
address@hidden debugger commands, @code{eval}
address@hidden debugger commands @subentry @code{eval}
@cindex @code{eval} debugger command
@cindex evaluate expressions, in debugger
@item @code{eval "@var{awk statements}"}
@@ -30202,8 +30202,8 @@ This form of @code{eval} is similar, but it allows you
to define
@var{awk statements}, instead of using variables or function
parameters defined by the program.
address@hidden debugger commands, @code{p} (@code{print})
address@hidden debugger commands, @code{print}
address@hidden debugger commands @subentry @code{p} (@code{print})
address@hidden debugger commands @subentry @code{print}
@cindex @code{print} debugger command
@cindex @code{p} debugger command (alias for @code{print})
@cindex print variables, in debugger
@@ -30230,7 +30230,7 @@ gawk> @kbd{print @@a}
This prints the indices and the corresponding values for all elements in
the array @code{a}.
address@hidden debugger commands, @code{printf}
address@hidden debugger commands @subentry @code{printf}
@cindex @code{printf} debugger command
@item @code{printf} @var{format} address@hidden,} @var{arg} @dots{}]
Print formatted text. The @var{format} may include escape sequences,
@@ -30238,9 +30238,9 @@ such as @samp{\n}
(@pxref{Escape Sequences}).
No newline is printed unless one is specified.
address@hidden debugger commands, @code{set}
address@hidden debugger commands @subentry @code{set}
@cindex @code{set} debugger command
address@hidden assign values to variables, in debugger
address@hidden assign values to variables @subentry in debugger
@item @code{set} @address@hidden@var{value}
Assign a constant (number or string) value to an @command{awk} variable
or field.
@@ -30249,8 +30249,8 @@ String values must be enclosed between double quotes
(@code{"address@hidden@code{"}).
You can also set special @command{awk} variables, such as @code{FS},
@code{NF}, @code{NR}, and so on.
address@hidden debugger commands, @code{w} (@code{watch})
address@hidden debugger commands, @code{watch}
address@hidden debugger commands @subentry @code{w} (@code{watch})
address@hidden debugger commands @subentry @code{watch}
@cindex @code{watch} debugger command
@cindex @code{w} debugger command (alias for @code{watch})
@cindex set watchpoint
@@ -30268,14 +30268,14 @@ evaluates whenever the watchpoint is reached. If the
condition is true,
then the debugger stops execution and prompts for a command. Otherwise,
@command{gawk} continues executing the program.
address@hidden debugger commands, @code{undisplay}
address@hidden debugger commands @subentry @code{undisplay}
@cindex @code{undisplay} debugger command
@cindex stop automatic display, in debugger
@item @code{undisplay} address@hidden
Remove item number @var{n} (or all items, if no argument) from the
automatic display list.
address@hidden debugger commands, @code{unwatch}
address@hidden debugger commands @subentry @code{unwatch}
@cindex @code{unwatch} debugger command
@cindex delete watchpoint
@item @code{unwatch} address@hidden
@@ -30294,9 +30294,9 @@ and also move around in the stack to see what the state
of things was in the
functions that called the one you are in. The commands for doing this are:
@table @asis
address@hidden debugger commands, @code{bt} (@code{backtrace})
address@hidden debugger commands, @code{backtrace}
address@hidden debugger commands, @code{where} (@code{backtrace})
address@hidden debugger commands @subentry @code{bt} (@code{backtrace})
address@hidden debugger commands @subentry @code{backtrace}
address@hidden debugger commands @subentry @code{where} (@code{backtrace})
@cindex @code{backtrace} debugger command
@cindex @code{bt} debugger command (alias for @code{backtrace})
@cindex @code{where} debugger command (alias for @code{backtrace})
@@ -30312,14 +30312,14 @@ function, the source @value{FN}, and the line number.
The alias @code{where} for @code{backtrace} is provided for longtime
GDB users who may be used to that command.
address@hidden debugger commands, @code{down}
address@hidden debugger commands @subentry @code{down}
@cindex @code{down} debugger command
@item @code{down} address@hidden
Move @var{count} (default 1) frames down the stack toward the innermost frame.
Then select and print the frame.
address@hidden debugger commands, @code{f} (@code{frame})
address@hidden debugger commands, @code{frame}
address@hidden debugger commands @subentry @code{f} (@code{frame})
address@hidden debugger commands @subentry @code{frame}
@cindex @code{frame} debugger command
@cindex @code{f} debugger command (alias for @code{frame})
@item @code{frame} address@hidden
@@ -30330,7 +30330,7 @@ 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.
address@hidden debugger commands, @code{up}
address@hidden debugger commands @subentry @code{up}
@cindex @code{up} debugger command
@item @code{up} address@hidden
Move @var{count} (default 1) frames up the stack toward the outermost frame.
@@ -30348,8 +30348,8 @@ is used with one of a number of arguments that tell it
exactly what
you want to know:
@table @asis
address@hidden debugger commands, @code{i} (@code{info})
address@hidden debugger commands, @code{info}
address@hidden debugger commands @subentry @code{i} (@code{info})
address@hidden debugger commands @subentry @code{info}
@cindex @code{info} debugger command
@cindex @code{i} debugger command (alias for @code{info})
@item @code{info} @var{what}
@@ -30411,12 +30411,12 @@ save the debugger's state, and the ability to run
debugger commands
from a file. The commands are:
@table @asis
address@hidden debugger commands, @code{o} (@code{option})
address@hidden debugger commands, @code{option}
address@hidden debugger commands @subentry @code{o} (@code{option})
address@hidden debugger commands @subentry @code{option}
@cindex @code{option} debugger command
@cindex @code{o} debugger command (alias for @code{option})
@cindex display debugger options
address@hidden debugger, options
address@hidden debugger @subentry options
@item @code{option} address@hidden@address@hidden
@itemx @code{o} address@hidden@address@hidden
Without an argument, display the available debugger options
@@ -30429,12 +30429,12 @@ The available options are:
@c asis for docbook
@table @asis
@item @code{history_size}
address@hidden debugger, history size
address@hidden debugger @subentry history size
Set the maximum number of lines to keep in the history file
@file{./.gawk_history}. The default is 100.
@item @code{listsize}
address@hidden debugger, default list amount
address@hidden debugger @subentry default list amount
Specify the number of lines that @code{list} prints. The default is 15.
@item @code{outfile}
@@ -30444,11 +30444,11 @@ to standard output. An empty string (@code{""})
resets output to
standard output.
@item @code{prompt}
address@hidden debugger, prompt
address@hidden debugger @subentry prompt
Change the debugger prompt. The default is @address@hidden> }}.
@item @code{save_history} address@hidden | @code{off}]
address@hidden debugger, history file
address@hidden debugger @subentry history file
Save command history to file @file{./.gawk_history}.
The default is @code{on}.
@@ -30460,17 +30460,17 @@ Options are read back into the next session upon
startup.
@item @code{trace} address@hidden | @code{off}]
@cindex instruction tracing, in debugger
address@hidden debugger, instruction tracing
address@hidden debugger @subentry instruction tracing
Turn instruction tracing on or off. The default is @code{off}.
@end table
address@hidden debugger, save commands to a file
address@hidden debugger @subentry save commands to a file
@item @code{save} @var{filename}
Save the commands from the current session to the given @value{FN},
so that they can be replayed using the @command{source} command.
@item @code{source} @var{filename}
address@hidden debugger, read commands from a file
address@hidden debugger @subentry read commands from a file
Run command(s) from a file; an error in any command does not
terminate execution of subsequent commands. Comments (lines starting
with @samp{#}) are allowed in a command file.
@@ -30494,7 +30494,7 @@ There are a few more commands that do not fit into the
previous categories, as follows:
@table @asis
address@hidden debugger commands, @code{dump}
address@hidden debugger commands @subentry @code{dump}
@cindex @code{dump} debugger command
@item @code{dump} address@hidden
Dump byte code of the program to standard output or to the file
@@ -30564,8 +30564,8 @@ gawk>
Exit the debugger.
See the entry for @samp{quit}, later in this list.
address@hidden debugger commands, @code{h} (@code{help})
address@hidden debugger commands, @code{help}
address@hidden debugger commands @subentry @code{h} (@code{help})
address@hidden debugger commands @subentry @code{help}
@cindex @code{help} debugger command
@cindex @code{h} debugger command (alias for @code{help})
@item @code{help}
@@ -30574,8 +30574,8 @@ Print a list of all of the @command{gawk} debugger
commands with a short
summary of their usage. @samp{help @var{command}} prints the information
about the command @var{command}.
address@hidden debugger commands, @code{l} (@code{list})
address@hidden debugger commands, @code{list}
address@hidden debugger commands @subentry @code{l} (@code{list})
address@hidden debugger commands @subentry @code{list}
@cindex @code{list} debugger command
@cindex @code{l} debugger command (alias for @code{list})
@item @code{list} address@hidden | @code{+} | @var{n} |
@address@hidden:address@hidden | @address@hidden | @var{function}]
@@ -30608,8 +30608,8 @@ Print lines centered around the beginning of the
function @var{function}. This command may change the current source file.
@end table
address@hidden debugger commands, @code{q} (@code{quit})
address@hidden debugger commands, @code{quit}
address@hidden debugger commands @subentry @code{q} (@code{quit})
address@hidden debugger commands @subentry @code{quit}
@cindex @code{quit} debugger command
@cindex @code{q} debugger command (alias for @code{quit})
@cindex exit the debugger
@@ -30621,7 +30621,7 @@ 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
@samp{q} or @samp{quit}, to make sure you really want to quit.
address@hidden debugger commands, @code{trace}
address@hidden debugger commands @subentry @code{trace}
@cindex @code{trace} debugger command
@item @code{trace} address@hidden | @code{off}]
Turn on or off continuous printing of the instructions that are about to
@@ -30637,9 +30637,9 @@ fairly self-explanatory, and using @code{stepi} and
@code{nexti} while
@node Readline Support
@section Readline Support
@cindex command completion, in debugger
address@hidden debugger, command completion
address@hidden debugger @subentry command completion
@cindex history expansion, in debugger
address@hidden debugger, history expansion
address@hidden debugger @subentry history expansion
If @command{gawk} is compiled with
@uref{http://cnswww.cns.cwru.edu/php/chet/readline/readline.html,
@@ -30678,7 +30678,7 @@ and
@node Limitations
@section Limitations
address@hidden debugger, limitations
address@hidden debugger @subentry limitations
We hope you find the @command{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 that it's worth being aware of are:
@@ -30857,8 +30857,8 @@ please report them (@xref{Bugs}).
@node Global Namespace
@section Standard @command{awk}'s Single Namespace
address@hidden namespace, definition of
address@hidden namespace, standard @command{awk}, global
address@hidden namespace @subentry definition of
address@hidden namespace @subentry standard @command{awk} @subentry global
In standard @command{awk}, there is a single, global, @dfn{namespace}.
This means that @emph{all} function names and global variable names must
be unique. For example, two different @command{awk} source files cannot
@@ -30888,9 +30888,10 @@ simple mechanism to put functions and global variables
into separate namespaces.
@node Qualified Names
@section Qualified Names
address@hidden qualified name, definition of
address@hidden namespaces, qualified names
address@hidden @code{::}, namespace separator
address@hidden qualified name @subentry definition of
address@hidden namespaces @subentry qualified names
address@hidden @code{:} (colon) @subentry @code{::} namespace separator
address@hidden colon (@code{:}) @subentry @code{::} namespace separator
@cindex component name
A @dfn{qualified name} is an identifier that includes a namespace name,
the namespace separator @code{::}, and a @dfn{component} name. For example,
one
@@ -30904,7 +30905,7 @@ Unlike C++, the @code{::} is @emph{not} an operator.
No spaces are
allowed between the namespace name, the @code{::}, and the component name.
@end quotation
address@hidden qualified name, use of
address@hidden qualified name @subentry use of
You must use qualified names from one namespace to access variables
and functions in another. This is especially important when using
variable names to index the special @code{SYMTAB} array (@pxref{Auto-set}),
@@ -30913,8 +30914,8 @@ and when making indirect function calls
(@pxref{Indirect Calls}).
@node Default Namespace
@section The Default Namespace
address@hidden namespace, default
address@hidden namespace, @code{awk}
address@hidden namespace @subentry default
address@hidden namespace @subentry @code{awk}
@cindex @code{awk} namespace
The default namespace, not surprisingly, is @code{awk}.
All of the predefined @command{awk} and @command{gawk} variables
@@ -30932,7 +30933,7 @@ It also keeps your code looking natural.
@node Changing The Namespace
@section Changing The Namespace
address@hidden namespaces, changing
address@hidden namespaces @subentry changing
@cindex @code{@@namespace} directive
In order to set the current namespace, use an @code{@@namespace} directive
at the top level of your program:
@@ -30958,15 +30959,15 @@ no concept of a ``current'' namespace once your
program starts executing.
Be sure you understand this.
@end quotation
address@hidden namespace, implicit
address@hidden namespace @subentry implicit
@cindex implicit namespace
Each source file for @option{-i} and @option{-f} starts out with
an implicit @samp{@@namespace "awk"}. Similarly, each chunk of
command-line code supplied with @option{-e} has such an implicit
initial statement (@pxref{Options}).
address@hidden current namespace, pushing and popping
address@hidden namespace, pushing and popping
address@hidden current namespace @subentry pushing and popping
address@hidden namespace @subentry pushing and popping
Files included with @code{@@include} (@pxref{Include Files}) ``push''
and ``pop'' the current namespace. That is, each @code{@@include} saves
the current namespace and starts over with an implicit @samp{@@namespace
@@ -30976,10 +30977,10 @@ file, the saved namespace is restored and processing
continues where it
left off in the original file.
@cindex @code{@@namespace}, no effect on @address@hidden @address@hidden
@address@hidden and @code{ENDFILE}
address@hidden @code{BEGIN} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{BEGINFILE} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{END} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{ENDFILE} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{BEGIN} pattern @subentry execution order not affected by
@code{@@namespace}
address@hidden @code{BEGINFILE} pattern @subentry execution order not affected
by @code{@@namespace}
address@hidden @code{END} pattern @subentry execution order not affected by
@code{@@namespace}
address@hidden @code{ENDFILE} pattern @subentry execution order not affected by
@code{@@namespace}
The use of @code{@@namespace} has no influence upon the order of execution
of @code{BEGIN}, @code{BEGINFILE}, @code{END}, and @code{ENDFILE} rules.
@@ -31055,8 +31056,8 @@ $ @kbd{gawk -f systime.awk}
@section Internal Name Management
@cindex name management
address@hidden @code{awk} namespace, identifier name storage
address@hidden @code{awk} namespace, use for indirect function calls
address@hidden @code{awk} namespace @subentry identifier name storage
address@hidden @code{awk} namespace @subentry use for indirect function calls
For backwards compatibility, all identifiers in the @code{awk} namespace
are stored internally as unadorned identifiers (that is, without a
leading @samp{awk::}). This is mainly relevant
@@ -31087,7 +31088,7 @@ function compute() @ii{This is really}
report::compute()
@node Namespace Example
@section Namespace Example
address@hidden namespace, example code
address@hidden namespace @subentry example code
The following example is a revised version of the suite of routines
developed in @ref{Passwd Functions}. See there for an explanation
of how the code works.
@@ -31213,8 +31214,8 @@ $ @kbd{gawk -f ns_passwd.awk -f testpasswd.awk}
This @value{SECTION} looks briefly at how the namespace facility interacts
with other important @command{gawk} features.
address@hidden namespaces, interaction with profiler
address@hidden namespaces, interaction with pretty printer
address@hidden namespaces @subentry interaction with profiler
address@hidden namespaces @subentry interaction with pretty printer
@cindex profiler, interaction with namespaces
@cindex pretty printer, interaction with namespaces
The profiler and pretty-printer (@pxref{Profiling}) have been enhanced
@@ -31224,14 +31225,14 @@ namespace together, and has @code{@@namespace}
directives in front
of rules as necessary. This allows component names to be
simple identifiers, instead of using qualified identifiers everywhere.
address@hidden namespaces, interaction with debugger
address@hidden debugger, interaction with namespaces
address@hidden namespaces @subentry interaction with debugger
address@hidden debugger @subentry interaction with namespaces
Interaction with the debugger (@pxref{Debugging}) has not had to change
(at least as of this writing). Some of the internal byte codes changed
in order to accommodate namespaces, and the debugger's @code{dump} command
was adjusted to match.
address@hidden namespaces, interaction with extension API
address@hidden namespaces @subentry interaction with extension API
@cindex extension API interaction with namespaces
The extension API (@pxref{Dynamic Extensions}) has always allowed for
placing functions into a different namespace, although this was not
@@ -31269,7 +31270,7 @@ namespaces smoothly with their operation. This applies
most notably to
the profiler / pretty-printer (@pxref{Profiling}) and to the extension
facility (@pxref{Dynamic Extensions}).
address@hidden namespaces, backwards compatibility
address@hidden namespaces @subentry backwards compatibility
@item
Overall, the namespace facility was designed and implemented such that
backwards compatibility is paramount. Programs that don't use namespaces
@@ -31282,7 +31283,7 @@ version of @command{gawk}.
@cindex arbitrary precision
@cindex multiple precision
@cindex infinite precision
address@hidden floating-point, address@hidden arbitrary-precision
address@hidden floating-point @subentry numbers, arbitrary-precision
This @value{CHAPTER} introduces some basic concepts relating to
how computers do arithmetic and defines some important terms.
@@ -31351,7 +31352,7 @@ The advantage to integer numbers is that they represent
values exactly.
The disadvantage is that their range is limited.
@cindex unsigned integers
address@hidden integers, unsigned
address@hidden integers @subentry unsigned
In computers, integer values come in two flavors: @dfn{signed} and
@dfn{unsigned}. Signed values may be negative or positive, whereas
unsigned values are always greater than or equal
@@ -31361,7 +31362,7 @@ In computer systems, integer arithmetic is exact, but
the possible
range of values is limited. Integer arithmetic is generally faster than
floating-point arithmetic.
address@hidden floating-point, numbers
address@hidden floating-point @subentry numbers
@item Floating-point arithmetic
Floating-point numbers represent what were called in school ``real''
numbers (i.e., those that have a fractional part, such as 3.1415927).
@@ -31373,9 +31374,9 @@ Modern systems support floating-point arithmetic in
hardware, with a
limited range of values. There are software libraries that allow
the use of arbitrary-precision floating-point calculations.
address@hidden floating-point, address@hidden single-precision
address@hidden floating-point, address@hidden double-precision
address@hidden floating-point, address@hidden arbitrary-precision
address@hidden floating-point @subentry numbers, single-precision
address@hidden floating-point @subentry numbers, double-precision
address@hidden floating-point @subentry numbers, arbitrary-precision
@cindex single-precision
@cindex double-precision
@cindex arbitrary precision
@@ -32045,7 +32046,7 @@ output when you change the rounding mode to be sure.
@node Arbitrary Precision Integers
@section Arbitrary-Precision Integer Arithmetic with @command{gawk}
address@hidden integers, arbitrary precision
address@hidden integers @subentry arbitrary precision
@cindex arbitrary precision integers
When given the @option{-M} option,
@@ -32278,9 +32279,9 @@ word sizes. See
@node Checking for MPFR
@section How To Check If MPFR Is Available
address@hidden MPFR, checking availability of
address@hidden MPFR @subentry checking availability of
@cindex checking for MPFR
address@hidden MPFR, checking for
address@hidden MPFR @subentry checking for
Occasionally, you might like to be able to check if @command{gawk}
was invoked with the @option{-M} option, enabling arbitrary-precision
arithmetic. You can do so with the following function, contributed
@@ -33137,7 +33138,7 @@ process and reduces the time needed to create the value.
@node Memory Allocation Functions
@subsection Memory Allocation Functions and Convenience Macros
@cindex allocating memory for extensions
address@hidden extensions, allocating memory
address@hidden extensions @subentry allocating memory
@cindex memory, allocating for extensions
The API provides a number of @dfn{memory allocation} functions for
@@ -34559,7 +34560,7 @@ you should release any cached values that you created,
using
@node Array Manipulation
@subsection Array Manipulation
@cindex array manipulation in extensions
address@hidden extensions, array manipulation in
address@hidden extensions @subentry array manipulation in
The primary data address@hidden, the only data structure.} in @command{awk}
is the associative array (@pxref{Arrays}).
@@ -35775,7 +35776,7 @@ static const char *ext_version = "filefuncs extension:
version 1.0";
int plugin_is_GPL_compatible;
@end example
address@hidden programming conventions, @command{gawk} extensions
address@hidden programming conventions @subentry @command{gawk} extensions
By convention, for an @command{awk} function @code{foo()}, the C function
that implements it is called @code{do_foo()}. The function should have
two arguments. The first is an @code{int}, usually called @code{nargs},
@@ -36117,7 +36118,7 @@ And that's it!
@node Using Internal File Ops
@subsection Integrating the Extensions
address@hidden @command{gawk}, address@hidden adding code to
address@hidden @command{gawk} @subentry interpreter, adding code to
Now that the code is written, it must be possible to add it at
runtime to the running @command{gawk} interpreter. First, the
code must be compiled. Assuming that the functions are in
@@ -36904,7 +36905,7 @@ for more information.
@node gawkextlib
@section The @code{gawkextlib} Project
@cindex @code{gawkextlib}
address@hidden extensions, where to find
address@hidden extensions @subentry where to find
@cindex @code{gawkextlib} project
The @uref{https://sourceforge.net/projects/gawkextlib/, @code{gawkextlib}}
@@ -37224,8 +37225,8 @@ online documentation}.
@node V7/SVR3.1
@appendixsec Major Changes Between V7 and SVR3.1
address@hidden @command{awk}, versions of
address@hidden @command{awk}, versions of, changes between V7 and SVR3.1
address@hidden @command{awk} @subentry versions of
address@hidden @command{awk} @subentry versions of @subentry changes between V7
and SVR3.1
The @command{awk} language evolved considerably between the release of
Version 7 Unix (1978) and the new version that was first made generally
available in
@@ -37315,7 +37316,7 @@ Multidimensional arrays
@node SVR4
@appendixsec Changes Between SVR3.1 and SVR4
address@hidden @command{awk}, versions of, changes between SVR3.1 and SVR4
address@hidden @command{awk} @subentry versions of @subentry changes between
SVR3.1 and SVR4
The System V Release 4 (1989) version of Unix @command{awk} added these
features
(some of which originated in @command{gawk}):
@@ -37373,8 +37374,8 @@ Processing of escape sequences inside command-line
variable assignments
@node POSIX
@appendixsec Changes Between SVR4 and POSIX @command{awk}
address@hidden @command{awk}, versions of, changes between SVR4 and POSIX
@command{awk}
address@hidden POSIX @command{awk}, changes in @command{awk} versions
address@hidden @command{awk} @subentry versions of @subentry changes between
SVR4 and POSIX @command{awk}
address@hidden POSIX @command{awk} @subentry changes in @command{awk} versions
The POSIX Command Language and Utilities standard for @command{awk} (1992)
introduced the following changes into the language:
@@ -37429,9 +37430,9 @@ The 2008 POSIX standard can be found online at
@node BTL
@appendixsec Extensions in Brian Kernighan's @command{awk}
address@hidden @command{awk}, versions of @seealso{Brian Kernighan's
@command{awk}}
address@hidden extensions, Brian Kernighan's @command{awk}
address@hidden Brian Kernighan's @command{awk}, extensions
address@hidden @command{awk} @subentry versions of @seealso{Brian Kernighan's
@command{awk}}
address@hidden extensions @subentry Brian Kernighan's @command{awk}
address@hidden Brian Kernighan's @command{awk} @subentry extensions
@cindex Kernighan, Brian
Brian Kernighan
has made his version available via his home page
@@ -37470,9 +37471,9 @@ available in his @command{awk}.
@node POSIX/GNU
@appendixsec Extensions in @command{gawk} Not in POSIX @command{awk}
address@hidden compatibility mode (@command{gawk}), extensions
address@hidden extensions, in @command{gawk}, not in POSIX @command{awk}
address@hidden POSIX, @command{gawk} extensions not included in
address@hidden compatibility mode (@command{gawk}) @subentry extensions
address@hidden extensions @subentry in @command{gawk} @subentry not in POSIX
@command{awk}
address@hidden POSIX @subentry @command{gawk} extensions not included in
The GNU implementation, @command{gawk}, adds a large number of features.
They can all be disabled with either the @option{--traditional} or
@option{--posix} options
@@ -38564,8 +38565,8 @@ to write code that takes the operating system /
platform into account.
@node Common Extensions
@appendixsec Common Extensions Summary
address@hidden extensions, Brian Kernighan's @command{awk}
address@hidden extensions, @command{mawk}
address@hidden extensions @subentry Brian Kernighan's @command{awk}
address@hidden extensions @subentry @command{mawk}
The following table summarizes the common extensions supported
by @command{gawk}, Brian Kernighan's @command{awk}, and @command{mawk},
the three most widely used freely available versions of @command{awk}
@@ -38695,7 +38696,7 @@ In all cases @command{gawk} remains POSIX-compliant.
@node Contributors
@appendixsec Major Contributors to @command{gawk}
address@hidden @command{gawk}, list of contributors to
address@hidden @command{gawk} @subentry list of contributors to
@quotation
@i{Always give credit where credit is due.}
@author Anonymous
@@ -39010,7 +39011,7 @@ the appropriate credit where credit is due.
@c last two commas are part of see also
@cindex operating systems @seealso{GNU/address@hidden PC operating
address@hidden Unix}
address@hidden @command{gawk}, installing
address@hidden @command{gawk} @subentry installing
@cindex installing @command{gawk}
This appendix provides instructions for installing @command{gawk} on the
various platforms that are supported by the developers. The primary
@@ -39033,7 +39034,7 @@ the respective ports.
@node Gawk Distribution
@appendixsec The @command{gawk} Distribution
address@hidden source code, @command{gawk}
address@hidden source code @subentry @command{gawk}
This @value{SECTION} describes how to get the @command{gawk}
distribution, how to extract it, and then what is in the various files and
@@ -39047,7 +39048,7 @@ subdirectories.
@node Getting
@appendixsubsec Getting the @command{gawk} Distribution
address@hidden @command{gawk}, source address@hidden obtaining
address@hidden @command{gawk} @subentry source code, obtaining
There are two ways to get GNU software:
@itemize @value{BULLET}
@@ -39123,7 +39124,7 @@ a local expert.
@node Distribution contents
@appendixsubsec Contents of the @command{gawk} Distribution
address@hidden @command{gawk}, distribution
address@hidden @command{gawk} @subentry distribution
The @command{gawk} distribution has a number of C source files,
documentation files,
@@ -39459,7 +39460,7 @@ Add the argument to the end of the @env{AWKLIBPATH}
environment variable.
@node Additional Configuration Options
@appendixsubsec Additional Configuration Options
address@hidden @command{gawk}, configuring, options
address@hidden @command{gawk} @subentry configuring @subentry options
@cindex configuration address@hidden @command{gawk}
There are several additional options you may use on the @command{configure}
@@ -39468,7 +39469,7 @@ command line when compiling @command{gawk} from
scratch, including:
@table @code
@cindex @option{--disable-extensions} configuration option
address@hidden configuration option, @code{--disable-extensions}
address@hidden configuration option @subentry @code{--disable-extensions}
@item --disable-extensions
Disable configuring and building the sample extensions in the
@file{extension} directory. This is useful for cross-compiling.
@@ -39476,7 +39477,7 @@ The default action is to dynamically check if the
extensions
can be configured and compiled.
@cindex @option{--disable-lint} configuration option
address@hidden configuration option, @code{--disable-lint}
address@hidden configuration option @subentry @code{--disable-lint}
@item --disable-lint
Disable all lint checking within @command{gawk}. The
@option{--lint} and @option{--lint-old} options
@@ -39499,21 +39500,21 @@ to fail. This option may be removed at a later date.
@end quotation
@cindex @option{--disable-mpfr} configuration option
address@hidden configuration option, @code{--disable-mpfr}
address@hidden configuration option @subentry @code{--disable-mpfr}
@item --disable-mpfr
Skip checking for the MPFR and GMP libraries. This is useful
mainly for the developers, to make sure nothing breaks if
MPFR support is not available.
@cindex @option{--disable-nls} configuration option
address@hidden configuration option, @code{--disable-nls}
address@hidden configuration option @subentry @code{--disable-nls}
@item --disable-nls
Disable all message-translation facilities.
This is usually not desirable, but it may bring you some slight performance
improvement.
@cindex @option{--enable-versioned-extension-dir} configuration option
address@hidden configuration option, @code{--enable-versioned-extension-dir}
address@hidden configuration option @subentry
@code{--enable-versioned-extension-dir}
@item --enable-versioned-extension-dir
Use a versioned directory for extensions. The directory name will
include the major and minor API versions in it. This makes it possible
@@ -39528,7 +39529,7 @@ options supplied by @command{configure}.
@node Configuration Philosophy
@appendixsubsec The Configuration Process
address@hidden @command{gawk}, configuring
address@hidden @command{gawk} @subentry configuring
This @value{SECTION} is of interest only if you know something about using the
C language and Unix-like operating systems.
@@ -39589,8 +39590,8 @@ various non-Unix systems.
@node PC Installation
@appendixsubsec Installation on MS-Windows
address@hidden PC operating systems, @command{gawk} on, installing
address@hidden operating systems, address@hidden @command{gawk} on, installing
address@hidden PC operating address@hidden @command{gawk} on, installing
address@hidden operating systems @subentry PC, @command{gawk} on @subentry
installing
This @value{SECTION} covers installation and usage of @command{gawk}
on Intel architecture machines running any version of MS-Windows.
In this @value{SECTION}, the term ``Windows32''
@@ -39639,8 +39640,8 @@ type @samp{make mingw32}.
@node PC Using
@appendixsubsubsec Using @command{gawk} on PC Operating Systems
address@hidden operating systems, address@hidden @command{gawk} on
address@hidden PC operating systems, @command{gawk} on
address@hidden operating systems, PC, @command{gawk} on
address@hidden PC operating systems @subentry @command{gawk} on
Information in this section applies to the MinGW and
DJGPP ports of @command{gawk}. @xref{Cygwin} for information
@@ -39652,10 +39653,10 @@ both the @samp{|&} operator and TCP/IP networking
The DJGPP environment does not support @samp{|&}.
@cindex search paths
address@hidden search paths, for source files
address@hidden @command{gawk}, MS-Windows version of
address@hidden @code{;} (semicolon), @env{AWKPATH} variable and
address@hidden semicolon (@code{;}), @env{AWKPATH} variable and
address@hidden search paths @subentry for source files
address@hidden @command{gawk} @subentry MS-Windows version of
address@hidden @code{;} (semicolon) @subentry @env{AWKPATH} variable and
address@hidden semicolon (@code{;}) @subentry @env{AWKPATH} variable and
@cindex @env{AWKPATH} environment variable
The MS-Windows version of @command{gawk} searches for
program files as described in @ref{AWKPATH Variable}. However,
@@ -39663,9 +39664,9 @@ semicolons (rather than colons) separate elements in
the @env{AWKPATH}
variable. If @env{AWKPATH} is not set or is empty, then the default
search path is @address@hidden;c:/lib/awk;c:/gnu/lib/awk}}.
address@hidden common extensions, @code{BINMODE} variable
address@hidden extensions, address@hidden @code{BINMODE} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{BINMODE}
variable
address@hidden common extensions @subentry @code{BINMODE} variable
address@hidden extensions @subentry common, @code{BINMODE} variable
address@hidden differences in @command{awk} and @command{gawk} @subentry
@code{BINMODE} variable
@cindex @code{BINMODE} variable
Under MS-Windows,
@command{gawk} (and many other text programs) silently
@@ -39808,7 +39809,7 @@ translation of @code{"\r\n"}, because it won't.
@c now address@hidden
@c now address@hidden
address@hidden @command{gawk}, VMS version of
address@hidden @command{gawk} @subentry VMS version of
@cindex installation, VMS
This @value{SUBSECTION} describes how to compile and install @command{gawk}
under VMS.
The older designation ``VMS'' is used throughout to refer to OpenVMS.
@@ -40023,7 +40024,7 @@ flag is required to force Unix-style parsing rather
than @code{DCL} parsing.
If any other dash-type options (or multiple parameters such as @value{DF}s to
process) are present, there is no ambiguity and @option{--} can be omitted.
address@hidden exit status, of @command{gawk}, on VMS
address@hidden exit status @subentry of @command{gawk} @subentry on VMS
The @code{exit} value is a Unix-style value and is encoded into a VMS exit
status value when the program exits.
@@ -40049,7 +40050,7 @@ Older versions of @command{gawk} for VMS treated a Unix
exit code 0 as 1,
a failure as 2, a fatal error as 4, and passed all the other numbers through.
This violated the VMS exit status coding requirements.
address@hidden floating-point, VAX/VMS
address@hidden floating-point @subentry VAX/VMS
VAX/VMS floating point uses unbiased rounding. @xref{Round Function}.
VMS reports time values in GMT unless one of the @code{SYS$TIMEZONE_RULE}
@@ -40059,7 +40060,7 @@ or @code{TZ} logical names is set. Older versions of
VMS, such as VAX/VMS
@c @cindex directory search
@c @cindex path, search
@cindex search paths
address@hidden search paths, for source files
address@hidden search paths @subentry for source files
The default search path, when looking for @command{awk} program files specified
by the @option{-f} option, is @code{"SYS$DISK:[],AWK_LIBRARY:"}. The logical
name @env{AWKPATH} can be used to override this default. The format
@@ -40187,8 +40188,8 @@ recommend compiling and using the current version.
@end quotation
@c the radio show, not the book. :-)
address@hidden debugging @command{gawk}, bug reports
address@hidden troubleshooting, @command{gawk}, bug reports
address@hidden debugging @command{gawk} @subentry bug reports
address@hidden troubleshooting @subentry @command{gawk} @subentry bug reports
If you have problems with @command{gawk} or think that you have found a bug,
report it to the developers; we cannot promise to do anything,
but we might well want to fix it.
@@ -40347,7 +40348,7 @@ report to the @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu
dot org} email list as we
@node Other Versions
@appendixsec Other Freely Available @command{awk} Implementations
address@hidden @command{awk}, implementations
address@hidden @command{awk} @subentry implementations
@ignore
From: emory!amc.com!brennan (Michael Brennan)
Subject: C++ comments in awk programs
@@ -40376,9 +40377,9 @@ This @value{SECTION} briefly describes where to get
them:
@table @asis
@cindex Kernighan, Brian
address@hidden source code, Brian Kernighan's @command{awk}
address@hidden @command{awk}, versions of @seealso{Brian Kernighan's
@command{awk}}
address@hidden Brian Kernighan's @command{awk}, source code
address@hidden source code @subentry Brian Kernighan's @command{awk}
address@hidden @command{awk} @subentry versions of @seealso{Brian Kernighan's
@command{awk}}
address@hidden Brian Kernighan's @command{awk} @subentry source code
@item Unix @command{awk}
Brian Kernighan, one of the original designers of Unix @command{awk},
has made his implementation of
@@ -40412,7 +40413,7 @@ available at
@uref{git://github.com/danfuzz/one-true-awk}.
@cindex Brennan, Michael
@cindex @command{mawk} utility
address@hidden source code, @command{mawk}
address@hidden source code @subentry @command{mawk}
@item @command{mawk}
Michael Brennan wrote an independent implementation of @command{awk},
called @command{mawk}. It is available under the
@@ -40449,7 +40450,7 @@ His development snapshots are available via Git from
the project's
@cindex Sumner, Andrew
@cindex @command{awka} compiler for @command{awk}
address@hidden source code, @command{awka}
address@hidden source code @subentry @command{awka}
@item @command{awka}
Written by Andrew Sumner,
@command{awka} translates @command{awk} programs into C, compiles them,
@@ -40469,7 +40470,7 @@ since approximately 2001.
@cindex Beebe, Nelson H.F.@:
@cindex @command{pawk} (profiling version of Brian Kernighan's @command{awk})
address@hidden source code, @command{pawk}
address@hidden source code @subentry @command{pawk}
@item @command{pawk}
Nelson H.F.@: Beebe at the University of Utah has modified
BWK @command{awk} to provide timing and profiling information.
@@ -40483,7 +40484,7 @@ or
@item BusyBox @command{awk}
@cindex BusyBox Awk
address@hidden source code, BusyBox Awk
address@hidden source code @subentry 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 @command{awk}. When building
@@ -40493,7 +40494,7 @@ information, see the @uref{https://busybox.net,
project's home page}.
@cindex OpenSolaris
@cindex Solaris, POSIX-compliant @command{awk}
address@hidden source code, Solaris @command{awk}
address@hidden source code @subentry Solaris @command{awk}
@item The OpenSolaris POSIX @command{awk}
The versions of @command{awk} in @file{/usr/xpg4/bin} and
@file{/usr/xpg6/bin} on Solaris are more or less POSIX-compliant.
@@ -40505,7 +40506,7 @@ has not been done, at least to our knowledge.
@cindex Illumos
@cindex Illumos, POSIX-compliant @command{awk}
address@hidden source code, Illumos @command{awk}
address@hidden source code @subentry Illumos @command{awk}
The source code used to be available from the OpenSolaris website.
However, that project was ended and the website shut down. Fortunately, the
@uref{https://wiki.illumos.org/display/illumos/illumos+Home, Illumos project}
@@ -40514,8 +40515,8 @@ makes this implementation available. You can view the
files one at a time from
@cindex @command{goawk}
@cindex Go implementation of @command{awk}
address@hidden source code, @command{goawk}
address@hidden programming languages, Go
address@hidden source code @subentry @command{goawk}
address@hidden programming languages @subentry Go
@item @command{goawk}
This is an @command{awk} interpreter written in the
@uref{https://golang.org/, Go programming language}.
@@ -40527,7 +40528,7 @@ describing the implementation.
@cindex @command{jawk}
@cindex Java implementation of @command{awk}
address@hidden source code, @command{jawk}
address@hidden source code @subentry @command{jawk}
@item @command{jawk}
This is an interpreter for @command{awk} written in Java. It claims
to be a full interpreter, although because it uses Java facilities
@@ -40537,13 +40538,13 @@ from POSIX @command{awk}. More information is
available on the
@item Libmawk
@cindex libmawk
address@hidden source code, libmawk
address@hidden source code @subentry libmawk
This is an embeddable @command{awk} interpreter derived from
@command{mawk}. For more information, see
@uref{http://repo.hu/projects/libmawk/}.
@item @code{pawk}
address@hidden source code, @command{pawk} (Python version)
address@hidden source code @subentry @command{pawk} (Python version)
@cindex @code{pawk}, @command{awk}-like facilities for Python
This is a Python module that claims to bring @command{awk}-like
features to Python. See @uref{https://github.com/alecthomas/pawk}
@@ -40552,13 +40553,13 @@ modified version of BWK @command{awk}, described
earlier.)
@item @w{QSE @command{awk}}
@cindex QSE @command{awk}
address@hidden source code, QSE @command{awk}
address@hidden source code @subentry QSE @command{awk}
This is an embeddable @command{awk} interpreter. For more information,
see @uref{https://code.google.com/p/qse/}. @c and
@uref{http://awk.info/?tools/qse}.
@item @command{QTawk}
@cindex QuikTrim Awk
address@hidden source code, QuikTrim Awk
address@hidden source code @subentry QuikTrim Awk
This is an independent implementation of @command{awk} distributed
under the GPL. It has a large number of extensions over standard
@command{awk} and may not be 100% syntactically compatible with it.
@@ -40622,8 +40623,8 @@ implementations. Many are POSIX-compliant; others are
less so.
@ifclear FOR_PRINT
@node Notes
@appendix Implementation Notes
address@hidden @command{gawk}, implementation issues
address@hidden implementation issues, @command{gawk}
address@hidden @command{gawk} @subentry implementation issues
address@hidden implementation issues @subentry @command{gawk}
This appendix contains information mainly of interest to implementers and
maintainers of @command{gawk}. Everything in it applies specifically to
@@ -40641,10 +40642,10 @@ maintainers of @command{gawk}. Everything in it
applies specifically to
@node Compatibility Mode
@appendixsec Downward Compatibility and Debugging
address@hidden @command{gawk}, implementation issues, downward compatibility
address@hidden @command{gawk}, implementation issues, debugging
address@hidden troubleshooting, @command{gawk}
address@hidden implementation issues, @command{gawk}, debugging
address@hidden @command{gawk} @subentry implementation issues @subentry
downward compatibility
address@hidden @command{gawk} @subentry implementation issues @subentry
debugging
address@hidden troubleshooting @subentry @command{gawk}
address@hidden implementation address@hidden @command{gawk}, debugging
@xref{POSIX/GNU},
for a summary of the GNU extensions to the @command{awk} language and program.
@@ -40726,9 +40727,9 @@ that has a Git plug-in for working with Git
repositories.
@node Adding Code
@appendixsubsec Adding New Features
address@hidden adding, features to @command{gawk}
address@hidden features, adding to @command{gawk}
address@hidden @command{gawk}, features, adding
address@hidden adding @subentry features to @command{gawk}
address@hidden features @subentry adding to @command{gawk}
address@hidden @command{gawk} @subentry features @subentry adding
You are free to add any new features you like to @command{gawk}.
However, if you want your changes to be incorporated into the @command{gawk}
distribution, there are several steps that you need to take in order to
@@ -40774,7 +40775,7 @@ the GNU Project's
@uref{https://www.gnu.org/prep/standards/, website}.
Texinfo, Info, and DVI versions are also available.)
address@hidden @command{gawk}, coding style in
address@hidden @command{gawk} @subentry coding style in
@item
Use the @command{gawk} coding style.
The C code for @command{gawk} follows the instructions in the
@@ -40900,8 +40901,8 @@ probably will not.
@node New Ports
@appendixsubsec Porting @command{gawk} to a New Operating System
address@hidden portability, @command{gawk}
address@hidden operating systems, porting @command{gawk} to
address@hidden portability @subentry @command{gawk}
address@hidden operating systems @subentry porting @command{gawk} to
@cindex porting @command{gawk}
If you want to port @command{gawk} to a new operating system, there are
@@ -41558,8 +41559,8 @@ removed from the code base with the 4.2 release.
@node Basic Concepts
@appendix Basic Programming Concepts
address@hidden programming, concepts
address@hidden programming, concepts
address@hidden programming @subentry concepts
address@hidden programming @subentry concepts
This @value{APPENDIX} attempts to define some of the basic concepts
and terms that are used throughout the rest of this @value{DOCUMENT}.
@@ -41615,7 +41616,7 @@ or it may be @dfn{interpreted}. In the latter case, a
machine-executable
program such as @command{awk} reads your program, and then uses the
instructions in your program to process the data.
address@hidden programming, basic steps
address@hidden programming @subentry basic steps
When you write a program, it usually consists
of the following, very basic set of steps,
@ifnotdocbook
@@ -41723,8 +41724,8 @@ and the fields of the record.
You may also group multiple
associated values under one name, as an array.
address@hidden values, numeric
address@hidden values, string
address@hidden values @subentry numeric
address@hidden values @subentry string
@cindex scalar values
Data, particularly in @command{awk}, consists of either numeric
values, such as 42 or 3.1415927, or string values.
@@ -41808,7 +41809,7 @@ rule's action. Actions are always enclosed in braces.
(@xref{Action Overview}.)
@cindex Ada programming language
address@hidden programming languages, Ada
address@hidden programming languages @subentry Ada
@item Ada
A programming language originally defined by the U.S.@: Department of
Defense for embedded programming. It was designed to enforce good
@@ -42403,7 +42404,7 @@ information about the name of the organization and its
language-independent
three-letter acronym.
@cindex Java programming language
address@hidden programming languages, Java
address@hidden programming languages @subentry Java
@item Java
A modern programming language originally developed by Sun Microsystems
(now Oracle) supporting Object-Oriented programming. Although usually
diff --git a/doc/list1 b/doc/list1
deleted file mode 100644
index 1ceb8cb..0000000
--- a/doc/list1
+++ /dev/null
@@ -1,1478 +0,0 @@
address@hidden @code{!} (exclamation point), @code{!=} operator
address@hidden @code{!} (exclamation point), @code{!} operator
address@hidden @code{!} (exclamation point), @code{!} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden @code{"} (double quote), in regexp constants
address@hidden @code{"} (double quote), in shell commands
address@hidden @code{#} (number sign), @code{#!} (executable scripts)
address@hidden @code{#} (number sign), commenting
address@hidden @code{$} (dollar sign), @code{$} field operator
address@hidden @code{$} (dollar sign), incrementing fields and arrays
address@hidden @code{$} (dollar sign), regexp operator
address@hidden @code{%} (percent sign), @code{%=} operator
address@hidden @code{%} (percent sign), @code{%} operator
address@hidden @code{&} (ampersand), @code{&&} operator
address@hidden @code{&} (ampersand), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden @code{'} (single quote), in shell commands
address@hidden @code{'} (single quote), vs.@: apostrophe
address@hidden @code{'} (single quote), with double quotes
address@hidden @code{()} (parentheses), in a profile
address@hidden @code{()} (parentheses), regexp operator
address@hidden @code{*} (asterisk), @code{**=} operator
address@hidden @code{*} (asterisk), @code{**} operator
address@hidden @code{*} (asterisk), @code{*=} operator
address@hidden @code{*} (asterisk), @code{*} operator, as multiplication
operator
address@hidden @code{*} (asterisk), @code{*} operator, as regexp operator
address@hidden @code{*} (asterisk), @code{*} operator, null address@hidden
matching
address@hidden @code{+} (plus sign), @code{++} operator
address@hidden @code{+} (plus sign), @code{+=} operator
address@hidden @code{+} (plus sign), @code{+} operator
address@hidden @code{+} (plus sign), regexp operator
address@hidden @code{,} (comma), in range patterns
address@hidden @code{-} (hyphen), @code{--} operator
address@hidden @code{-} (hyphen), @code{-=} operator
address@hidden @code{-} (hyphen), @code{-} operator
address@hidden @code{-} (hyphen), file names beginning with
address@hidden @code{-} (hyphen), in bracket expressions
address@hidden @code{.gmo} files, specifying directory of
address@hidden @code{.mo} files, converting from @code{.po}
address@hidden @code{.po} files, converting to @code{.mo}
address@hidden @code{.} (period), regexp operator
address@hidden @code{/} (forward slash), @code{/=} operator
address@hidden @code{/} (forward slash), @code{/=} operator, vs.
@code{/address@hidden/} regexp constant
address@hidden @code{/} (forward slash), @code{/} operator
address@hidden @code{/} (forward slash), patterns and
address@hidden @code{::}, namespace separator
address@hidden @code{:} (colon), @code{?:} operator
address@hidden @code{;} (semicolon), @env{AWKPATH} variable and
address@hidden @code{;} (semicolon), separating rules
address@hidden @code{;} (semicolon), separating statements in actions
address@hidden @code{<} (left angle bracket), @code{<=} operator
address@hidden @code{<} (left angle bracket), @code{<} operator
address@hidden @code{<} (left angle bracket), @code{<} operator (I/O)
address@hidden @code{=} (equals sign), @code{==} operator
address@hidden @code{=} (equals sign), @code{=} operator
address@hidden @code{>} (right angle bracket), @code{>=} operator
address@hidden @code{>} (right angle bracket), @code{>>} operator (I/O)
address@hidden @code{>} (right angle bracket), @code{>} operator
address@hidden @code{>} (right angle bracket), @code{>} operator (I/O)
address@hidden @code{?} (question mark), @code{?:} operator
address@hidden @code{?} (question mark), regexp operator
address@hidden @code{@@namespace}, no effect on @address@hidden @address@hidden
@address@hidden and @code{ENDFILE}
address@hidden @address@hidden@}} (braces), actions and
address@hidden @address@hidden@}} (braces), statements, grouping
address@hidden @code{ARGC}/@code{ARGV} variables, command-line arguments
address@hidden @code{ARGC}/@code{ARGV} variables, how to use
address@hidden @code{ARGC}/@code{ARGV} variables, portability and
address@hidden @code{ARGIND} variable, command-line arguments
address@hidden @code{ARGV} array, indexing into
address@hidden @code{BEGINFILE} pattern, Boolean patterns and
address@hidden @code{BEGINFILE} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{BEGIN} pattern, @code{OFS}/@code{ORS} variables, assigning
values to
address@hidden @code{BEGIN} pattern, @code{TEXTDOMAIN} variable and
address@hidden @code{BEGIN} pattern, @code{assert()} user-defined function and
address@hidden @code{BEGIN} pattern, @code{exit} statement and
address@hidden @code{BEGIN} pattern, @code{getline} and
address@hidden @code{BEGIN} pattern, @code{next}/@code{nextfile} statements and
address@hidden @code{BEGIN} pattern, @code{print} statement and
address@hidden @code{BEGIN} pattern, @code{pwcat} program
address@hidden @code{BEGIN} pattern, Boolean patterns and
address@hidden @code{BEGIN} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{BEGIN} pattern, address@hidden adding
address@hidden @code{BEGIN} pattern, operators and
address@hidden @code{BEGIN} pattern, profiling and
address@hidden @code{BEGIN} pattern, running @command{awk} programs and
address@hidden @code{CONVFMT} variable, array subscripts and
address@hidden @code{ENDFILE} pattern, Boolean patterns and
address@hidden @code{ENDFILE} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{END} pattern, @code{assert()} user-defined function and
address@hidden @code{END} pattern, @code{exit} statement and
address@hidden @code{END} pattern, @code{next}/@code{nextfile} statements and
address@hidden @code{END} pattern, @code{print} statement and
address@hidden @code{END} pattern, Boolean patterns and
address@hidden @code{END} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{END} pattern, operators and
address@hidden @code{END} pattern, profiling and
address@hidden @code{ERRNO} variable, with @code{BEGINFILE} pattern
address@hidden @code{ERRNO} variable, with @command{close()} function
address@hidden @code{ERRNO} variable, with @command{getline} command
address@hidden @code{FILENAME} variable, @address@hidden setting with
address@hidden @code{FNR} variable, changing
address@hidden @code{FS} variable, @code{--field-separator} option and
address@hidden @code{FS} variable, TAB character as
address@hidden @code{FS} variable, as null string
address@hidden @code{FS} variable, changing value of
address@hidden @code{FS} variable, running @command{awk} programs and
address@hidden @code{FS} variable, setting from command line
address@hidden @code{FS}, containing @code{^}
address@hidden @code{FS}, in multiline records
address@hidden @code{HUP} signal, for dynamic profiling
address@hidden @code{IGNORECASE} variable, array indices and
address@hidden @code{IGNORECASE} variable, array sorting functions and
address@hidden @code{IGNORECASE} variable, in example programs
address@hidden @code{IGNORECASE} variable, with @code{~} and @code{!~} operators
address@hidden @code{LC_MESSAGES} locale category, @code{bindtextdomain()}
function (@command{gawk})
address@hidden @code{NF} variable, decrementing
address@hidden @code{NR} variable, changing
address@hidden @code{OFMT} variable, POSIX @command{awk} and
address@hidden @code{PROCINFO} array, communications via ptys and
address@hidden @code{PROCINFO} array, group membership and
address@hidden @code{PROCINFO} array, testing the field splitting
address@hidden @code{PROCINFO} array, user and group ID numbers and
address@hidden @code{PROCINFO}, values of @code{sorted_in}
address@hidden @code{RLENGTH} variable, @code{match()} function and
address@hidden @code{RSTART} variable, @code{match()} function and
address@hidden @code{RS} variable, multiline records and
address@hidden @code{SIGHUP} signal, for dynamic profiling
address@hidden @code{SIGUSR1} signal, for dynamic profiling
address@hidden @code{SUBSEP} variable, multidimensional arrays and
address@hidden @code{TEXTDOMAIN} variable, @code{BEGIN} pattern and
address@hidden @code{TEXTDOMAIN} variable, portability and
address@hidden @code{USR1} signal, for dynamic profiling
address@hidden @code{[]} (square brackets), regexp operator
address@hidden @code{\} (backslash), @code{\"} escape sequence
address@hidden @code{\} (backslash), @code{\'} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\/} escape sequence
address@hidden @code{\} (backslash), @code{\<} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\>} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\B} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\S} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\W} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\`} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\a} escape sequence
address@hidden @code{\} (backslash), @code{\b} escape sequence
address@hidden @code{\} (backslash), @code{\f} escape sequence
address@hidden @code{\} (backslash), @code{\n} escape sequence
address@hidden @code{\} (backslash), @code{\r} escape sequence
address@hidden @code{\} (backslash), @code{\s} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\t} escape sequence
address@hidden @code{\} (backslash), @code{\v} escape sequence
address@hidden @code{\} (backslash), @code{\w} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\x} escape sequence
address@hidden @code{\} (backslash), @code{\y} operator (@command{gawk})
address@hidden @code{\} (backslash), @address@hidden escape sequence
address@hidden @code{\} (backslash), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden @code{\} (backslash), as field separator
address@hidden @code{\} (backslash), continuing lines and
address@hidden @code{\} (backslash), continuing lines and, comments and
address@hidden @code{\} (backslash), continuing lines and, in @command{csh}
address@hidden @code{\} (backslash), in bracket expressions
address@hidden @code{\} (backslash), in escape sequences
address@hidden @code{\} (backslash), in escape sequences, POSIX and
address@hidden @code{\} (backslash), in regexp constants
address@hidden @code{\} (backslash), in shell commands
address@hidden @code{\} (backslash), regexp operator
address@hidden @code{^} (caret), @code{^=} operator
address@hidden @code{^} (caret), @code{^} operator
address@hidden @code{^} (caret), in @code{FS}
address@hidden @code{^} (caret), in bracket expressions
address@hidden @code{^} (caret), regexp operator
address@hidden @code{_} (underscore), C macro
address@hidden @code{_} (underscore), in names of private variables
address@hidden @code{_} (underscore), translatable string
address@hidden @code{asort()} function (@command{gawk}), address@hidden sorting
address@hidden @code{asorti()} function (@command{gawk}), address@hidden sorting
address@hidden @code{awk} namespace, identifier name storage
address@hidden @code{awk} namespace, use for indirect function calls
address@hidden @code{bindtextdomain()} function (@command{gawk}), portability
and
address@hidden @code{close()} function, portability
address@hidden @code{close()} function, return value
address@hidden @code{close()} function, two-way pipes and
address@hidden @code{date} utility, POSIX
address@hidden @code{dcgettext()} function (@command{gawk}), portability and
address@hidden @code{dcngettext()} function (@command{gawk}), portability and
address@hidden @address@hidden statement, use of regexps in
address@hidden @code{for} statement, looping over arrays
address@hidden @code{gensub()} function (@command{gawk}), escape processing
address@hidden @code{getgruser()} function, user-defined
address@hidden @code{getline} command, @code{FILENAME} variable and
address@hidden @code{getline} command, @code{_gr_init()} user-defined function
address@hidden @code{getline} command, @code{_pw_init()} function
address@hidden @code{getline} command, address@hidden using from
address@hidden @code{getline} command, deadlock and
address@hidden @code{getline} command, explicit input with
address@hidden @code{getline} command, return values
address@hidden @code{getline} command, variants
address@hidden @code{getline} statement, @code{BEGINFILE}/@code{ENDFILE}
patterns and
address@hidden @code{gsub()} function, arguments of
address@hidden @code{gsub()} function, escape processing
address@hidden @code{if} statement, address@hidden changing
address@hidden @code{if} statement, use of regexps in
address@hidden @code{in} operator, index existence in multidimensional arrays
address@hidden @code{in} operator, order of array access
address@hidden @code{in} operator, testing if array element exists
address@hidden @code{in} operator, use in loops
address@hidden @code{match()} function, @code{RSTART}/@code{RLENGTH} variables
address@hidden @code{nextfile} statement, @code{BEGINFILE}/@code{ENDFILE}
patterns and
address@hidden @code{nextfile} statement, @code{BEGIN}/@code{END} patterns and
address@hidden @code{nextfile} statement, user-defined functions and
address@hidden @code{next} statement, @code{BEGINFILE}/@code{ENDFILE} patterns
and
address@hidden @code{next} statement, @code{BEGIN}/@code{END} patterns and
address@hidden @code{next} statement, user-defined functions and
address@hidden @code{pawk}, @command{awk}-like facilities for Python
address@hidden @code{printf} statement, @code{sprintf()} function and
address@hidden @code{printf} statement, I/O operators in
address@hidden @code{printf} statement, address@hidden aligning
address@hidden @code{printf} statement, format-control characters
address@hidden @code{printf} statement, modifiers
address@hidden @code{printf} statement, positional specifiers
address@hidden @code{printf} statement, positional specifiers, mixing with
regular formats
address@hidden @code{printf} statement, syntax of
address@hidden @code{print} statement, @code{BEGIN}/@code{END} patterns and
address@hidden @code{print} statement, @code{OFMT} variable and
address@hidden @code{print} statement, @code{sprintf()} function and
address@hidden @code{print} statement, I/O operators in
address@hidden @code{print} statement, commas, omitting
address@hidden @code{print} statement, line continuations and
address@hidden @code{split()} function, array address@hidden deleting
address@hidden @code{sprintf()} function, @code{print}/@code{printf} statements
and
address@hidden @code{strtonum()} function (@command{gawk}),
@code{--non-decimal-data} option and
address@hidden @code{sub()} function, arguments of
address@hidden @code{sub()} function, escape processing
address@hidden @code{while} statement, use of regexps in
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O)
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O),
address@hidden closing
address@hidden @code{|} (vertical bar), @code{||} operator
address@hidden @code{|} (vertical bar), @code{|} operator (I/O)
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @command{awk} debugging, enabling
address@hidden @command{awk} language, POSIX version
address@hidden @command{awk} profiling, enabling
address@hidden @command{awk} programs, complex
address@hidden @command{awk} programs, documenting
address@hidden @command{awk} programs, examples of
address@hidden @command{awk} programs, execution of
address@hidden @command{awk} programs, internationalizing
address@hidden @command{awk} programs, lengthy
address@hidden @command{awk} programs, lengthy, assertions
address@hidden @command{awk} programs, location of
address@hidden @command{awk} programs, one-line examples
address@hidden @command{awk} programs, profiling
address@hidden @command{awk} programs, running
address@hidden @command{awk} programs, running, from shell scripts
address@hidden @command{awk} programs, running, without input files
address@hidden @command{awk} programs, shell variables in
address@hidden @command{awk}, @command{gawk} and
address@hidden @command{awk}, POSIX and
address@hidden @command{awk}, POSIX and @seealso{POSIX @command{awk}}
address@hidden @command{awk}, function of
address@hidden @command{awk}, history of
address@hidden @command{awk}, implementation issues, pipes
address@hidden @command{awk}, implementations
address@hidden @command{awk}, implementations, limits
address@hidden @command{awk}, invoking
address@hidden @command{awk}, new vs.@: old
address@hidden @command{awk}, new vs.@: old, @code{OFMT} variable
address@hidden @command{awk}, regexp constants and
address@hidden @command{awk}, terms describing
address@hidden @command{awk}, uses for
address@hidden @command{awk}, versions of
address@hidden @command{awk}, versions of @seealso{Brian Kernighan's
@command{awk}}
address@hidden @command{awk}, versions of, changes between SVR3.1 and SVR4
address@hidden @command{awk}, versions of, changes between SVR4 and POSIX
@command{awk}
address@hidden @command{awk}, versions of, changes between V7 and SVR3.1
address@hidden @command{csh} utility, @code{|&} operator, comparison with
address@hidden @command{csh} utility, @env{POSIXLY_CORRECT} environment variable
address@hidden @command{date} utility, GNU
address@hidden @command{gawk} program, dynamic profiling
address@hidden @command{gawk}, @code{ARGIND} variable in
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @command{gawk}, @code{FIELDWIDTHS} variable in
address@hidden @command{gawk}, @code{FPAT} variable in
address@hidden @command{gawk}, @code{FUNCTAB} array in
address@hidden @command{gawk}, @code{IGNORECASE} variable in
address@hidden @command{gawk}, @code{LINT} variable in
address@hidden @command{gawk}, @code{PROCINFO} array in
address@hidden @command{gawk}, @code{RT} variable in
address@hidden @command{gawk}, @code{SYMTAB} array in
address@hidden @command{gawk}, @code{TEXTDOMAIN} variable in
address@hidden @command{gawk}, @code{break} statement in
address@hidden @command{gawk}, @code{continue} statement in
address@hidden @command{gawk}, @command{awk} and
address@hidden @command{gawk}, MS-Windows version of
address@hidden @command{gawk}, VMS version of
address@hidden @command{gawk}, bitwise operations in
address@hidden @command{gawk}, character classes and
address@hidden @command{gawk}, coding style in
address@hidden @command{gawk}, command-line options, and regular expressions
address@hidden @command{gawk}, configuring
address@hidden @command{gawk}, configuring, options
address@hidden @command{gawk}, distribution
address@hidden @command{gawk}, escape sequences
address@hidden @command{gawk}, address@hidden disabling
address@hidden @command{gawk}, features, adding
address@hidden @command{gawk}, features, advanced
address@hidden @command{gawk}, field separators and
address@hidden @command{gawk}, file names in
address@hidden @command{gawk}, format-control characters
address@hidden @command{gawk}, function arguments and
address@hidden @command{gawk}, hexadecimal numbers and
address@hidden @command{gawk}, implementation issues
address@hidden @command{gawk}, implementation issues, debugging
address@hidden @command{gawk}, implementation issues, downward compatibility
address@hidden @command{gawk}, implementation issues, limits
address@hidden @command{gawk}, implementation issues, pipes
address@hidden @command{gawk}, installing
address@hidden @command{gawk}, internationalization and
@seeentry{internationalization}
address@hidden @command{gawk}, address@hidden adding code to
address@hidden @command{gawk}, interval expressions and
address@hidden @command{gawk}, line continuation in
address@hidden @command{gawk}, list of contributors to
address@hidden @command{gawk}, newlines in
address@hidden @command{gawk}, octal numbers and
address@hidden @command{gawk}, predefined variables and
address@hidden @command{gawk}, regexp constants and
address@hidden @command{gawk}, regular expressions, case sensitivity
address@hidden @command{gawk}, regular expressions, operators
address@hidden @command{gawk}, regular expressions, precedence
address@hidden @command{gawk}, source address@hidden obtaining
address@hidden @command{gawk}, splitting fields and
address@hidden @command{gawk}, string-translation functions
address@hidden @command{gawk}, timestamps
address@hidden @command{gawk}, uses for
address@hidden @command{gawk}, versions of, information address@hidden printing
address@hidden @command{gawk}, word-boundary operator
address@hidden @command{gettext} library, locale categories
address@hidden @command{sort} utility, coprocesses and
address@hidden @option{--dump-variables} option, using for library functions
address@hidden @option{--non-decimal-data} option, @code{strtonum()} function
and
address@hidden @option{--posix} option, @code{--traditional} option and
address@hidden @option{--sandbox} option, disabling @code{system()} function
address@hidden @option{--sandbox} option, input redirection with @code{getline}
address@hidden @option{--sandbox} option, output redirection with @code{print},
@code{printf}
address@hidden @option{--traditional} option, @code{--posix} option and
address@hidden @option{-F} option, @option{-Ft} sets @code{FS} to TAB
address@hidden @option{-F} option, command-line
address@hidden @option{-f} option, multiple uses
address@hidden Aho, Alfred
address@hidden Beebe, Nelson H.F.@:
address@hidden Bentley, Jon
address@hidden Benzinger, Michael
address@hidden Berry, Karl
address@hidden Boolean expressions, as patterns
address@hidden Bourne shell, quoting rules for
address@hidden Brennan, Michael
address@hidden Brian Kernighan's @command{awk}, extensions
address@hidden Brian Kernighan's @command{awk}, source code
address@hidden Brini, Davide
address@hidden Brink, Jeroen
address@hidden Broder, Alan J.@:
address@hidden Brown, Martin
address@hidden Buening, Andreas
address@hidden CGI, @command{awk} scripts for
address@hidden Chassell, Robert J.@:
address@hidden Close, Diane
address@hidden Collado, Manuel
address@hidden Colombo, Antonio
address@hidden Curreli, Marco
address@hidden Davies, Stephen
address@hidden Day, Robert P.J.@:
address@hidden Deifik, Scott
address@hidden Demaille, Akim
address@hidden Drepper, Ulrich
address@hidden Duman, Patrice
address@hidden English, Steve
address@hidden Fenlason, Jay
address@hidden Fish, Fred
address@hidden G., Daniel Richard
address@hidden GNU long options, printing list of
address@hidden GPL (General Public License), printing
address@hidden Garfinkle, Scott
address@hidden Git, use of for @command{gawk} source code
address@hidden Gordon, Assaf
address@hidden Grigera, Juan
address@hidden Guerrero, Juan Manuel
address@hidden Hankerson, Darrel
address@hidden Haque, John
address@hidden Hartholz, Elaine
address@hidden Hartholz, Marshall
address@hidden Hasegawa, Isamu
address@hidden Hughes, Phil
address@hidden Illumos, POSIX-compliant @command{awk}
address@hidden Jacobs, Andrew
address@hidden Jaegermann, Michal
address@hidden Johansen, Chris
address@hidden Kahrs, J@"urgen
address@hidden Kasal, Stepan
address@hidden Kenobi, Obi-Wan
address@hidden Kernighan, Brian
address@hidden Kwok, Conrad
address@hidden Langston, Peter
address@hidden MPFR, checking availability of
address@hidden MPFR, checking for
address@hidden Malmberg, John
address@hidden Marx, Groucho
address@hidden McIlroy, Doug
address@hidden McPhee, Patrick
address@hidden Moore, Duncan
address@hidden Oram, Andy
address@hidden PC operating systems, @command{gawk} on
address@hidden PC operating systems, @command{gawk} on, installing
address@hidden POSIX @command{awk}, @code{**=} operator and
address@hidden POSIX @command{awk}, @code{**} operator and
address@hidden POSIX @command{awk}, @code{<} operator and
address@hidden POSIX @command{awk}, @code{BEGIN}/@code{END} patterns
address@hidden POSIX @command{awk}, @code{CONVFMT} variable and
address@hidden POSIX @command{awk}, @code{OFMT} variable and
address@hidden POSIX @command{awk}, @code{break} statement and
address@hidden POSIX @command{awk}, @code{continue} statement and
address@hidden POSIX @command{awk}, @code{date} utility and
address@hidden POSIX @command{awk}, @code{function} keyword in
address@hidden POSIX @command{awk}, @code{next}/@code{nextfile} statements and
address@hidden POSIX @command{awk}, @code{printf} format strings and
address@hidden POSIX @command{awk}, @code{|} I/O operator and
address@hidden POSIX @command{awk}, GNU long options and
address@hidden POSIX @command{awk}, arithmetic operators and
address@hidden POSIX @command{awk}, backslashes in string constants
address@hidden POSIX @command{awk}, bracket expressions and
address@hidden POSIX @command{awk}, bracket expressions and, character classes
address@hidden POSIX @command{awk}, changes in @command{awk} versions
address@hidden POSIX @command{awk}, field separators and
address@hidden POSIX @command{awk}, functions and, @code{gsub()}/@code{sub()}
address@hidden POSIX @command{awk}, functions and, @code{length()}
address@hidden POSIX @command{awk}, interval expressions in
address@hidden POSIX @command{awk}, numeric strings and
address@hidden POSIX @command{awk}, period (@code{.})@comma{} using
address@hidden POSIX @command{awk}, regular expressions and
address@hidden POSIX @command{awk}, timestamps and
address@hidden POSIX, @command{awk} and
address@hidden POSIX, @command{gawk} extensions not included in
address@hidden POSIX, address@hidden implementing in @command{awk}
address@hidden Papadopoulos, Panos
address@hidden Peters, Arno
address@hidden Peterson, Hal
address@hidden Pitts, Dave
address@hidden Plauger, P.J.@:
address@hidden Quanstrom, Erik
address@hidden Rakitzis, Byron
address@hidden Ramey, Chet
address@hidden Rankin, Pat
address@hidden Ritchie, Dennis
address@hidden Robbins, Arnold
address@hidden Robbins, Bill
address@hidden Robbins, Harry
address@hidden Robbins, Jean
address@hidden Robbins, Miriam
address@hidden Rommel, Kai Uwe
address@hidden Rubin, Paul
address@hidden Schorr, Andrew
address@hidden Schreiber, Bert
address@hidden Schreiber, Rita
address@hidden Skywalker, Luke
address@hidden Solaris, POSIX-compliant @command{awk}
address@hidden Spencer, Henry
address@hidden Stallman, Richard
address@hidden Sumner, Andrew
address@hidden TCP/IP, support for
address@hidden Texinfo, chapter beginnings in files
address@hidden Texinfo, extracting programs from source files
address@hidden Trueman, David
address@hidden Unix @command{awk}, @code{close()} function and
address@hidden Unix @command{awk}, backslashes in escape sequences
address@hidden Unix @command{awk}, password address@hidden field separators and
address@hidden Unix, @command{awk} scripts and
address@hidden Vinschen, Corinna
address@hidden Wall, Larry
address@hidden Wallin, Anders
address@hidden Weinberger, Peter
address@hidden Williams, Kent
address@hidden Woehlke, Matthew
address@hidden Woods, John
address@hidden Yawitz, Efraim
address@hidden Zaretskii, Eli
address@hidden Zoulas, Christos
address@hidden actions, control statements in
address@hidden actions, default
address@hidden actions, empty
address@hidden adding, features to @command{gawk}
address@hidden adding, fields
address@hidden advanced features, @command{gawk}
address@hidden advanced features, fixed-width data
address@hidden advanced features, network programming
address@hidden advanced features, nondecimal input data
address@hidden advanced features, address@hidden communicating with
address@hidden advanced features, specifying field content
address@hidden ambiguity, syntactic: @code{/=} operator vs.
@code{/address@hidden/} regexp constant
address@hidden ampersand (@code{&}), @code{&&} operator
address@hidden ampersand (@code{&}), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden anagrams, finding
address@hidden arguments, command-line
address@hidden arguments, command-line, invoking @command{awk}
address@hidden arguments, in function calls
address@hidden arguments, processing
address@hidden array scanning order, controlling
address@hidden array subscripts, null strings as
address@hidden array subscripts, numbers as
address@hidden array, number of elements
address@hidden arrays, @code{IGNORECASE} variable and
address@hidden arrays, @code{for} statement and
address@hidden arrays, an example of using
address@hidden arrays, as parameters to functions
address@hidden arrays, associative
address@hidden arrays, associative, library functions and
address@hidden arrays, deleting entire contents
address@hidden arrays, elements that don't exist
address@hidden arrays, elements, assigning values
address@hidden arrays, elements, deleting
address@hidden arrays, elements, order of access by @code{in} operator
address@hidden arrays, elements, retrieving number of
address@hidden arrays, indexing
address@hidden arrays, merging into strings
address@hidden arrays, multidimensional
address@hidden arrays, multidimensional, scanning
address@hidden arrays, numeric subscripts
address@hidden arrays, referencing elements
address@hidden arrays, scanning
address@hidden arrays, sorting
address@hidden arrays, sorting, @code{IGNORECASE} variable and
address@hidden arrays, sparse
address@hidden arrays, subscripts, uninitialized variables as
address@hidden arrays, unassigned elements
address@hidden assign values to variables, in debugger
address@hidden assignment operators, evaluation order
address@hidden assignment operators, lvalues/rvalues
address@hidden asterisk (@code{*}), @code{**=} operator
address@hidden asterisk (@code{*}), @code{**} operator
address@hidden asterisk (@code{*}), @code{*=} operator
address@hidden asterisk (@code{*}), @code{*} operator, as multiplication
operator
address@hidden asterisk (@code{*}), @code{*} operator, as regexp operator
address@hidden asterisk (@code{*}), @code{*} operator, null address@hidden
matching
address@hidden automatic displays, in debugger
address@hidden backslash (@code{\}), @code{\"} escape sequence
address@hidden backslash (@code{\}), @code{\'} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\/} escape sequence
address@hidden backslash (@code{\}), @code{\<} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\>} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\B} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\S} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\W} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\`} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\a} escape sequence
address@hidden backslash (@code{\}), @code{\b} escape sequence
address@hidden backslash (@code{\}), @code{\f} escape sequence
address@hidden backslash (@code{\}), @code{\n} escape sequence
address@hidden backslash (@code{\}), @code{\r} escape sequence
address@hidden backslash (@code{\}), @code{\s} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\t} escape sequence
address@hidden backslash (@code{\}), @code{\v} escape sequence
address@hidden backslash (@code{\}), @code{\w} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\x} escape sequence
address@hidden backslash (@code{\}), @code{\y} operator (@command{gawk})
address@hidden backslash (@code{\}), @address@hidden escape sequence
address@hidden backslash (@code{\}), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden backslash (@code{\}), as field separator
address@hidden backslash (@code{\}), continuing lines and
address@hidden backslash (@code{\}), continuing lines and, comments and
address@hidden backslash (@code{\}), continuing lines and, in @command{csh}
address@hidden backslash (@code{\}), in bracket expressions
address@hidden backslash (@code{\}), in escape sequences
address@hidden backslash (@code{\}), in escape sequences, POSIX and
address@hidden backslash (@code{\}), in regexp constants
address@hidden backslash (@code{\}), in shell commands
address@hidden backslash (@code{\}), regexp operator
address@hidden bitwise, operations
address@hidden bitwise, shift
address@hidden body, in actions
address@hidden body, in loops
address@hidden braces (@address@hidden@}}), actions and
address@hidden braces (@address@hidden@}}), statements, grouping
address@hidden bracket expressions, character classes
address@hidden bracket expressions, collating elements
address@hidden bracket expressions, collating symbols
address@hidden bracket expressions, complemented
address@hidden bracket expressions, equivalence classes
address@hidden bracket expressions, non-ASCII
address@hidden bracket expressions, range expressions
address@hidden breakpoint at location, how to delete
address@hidden breakpoint, delete by number
address@hidden breakpoint, how to disable or enable
address@hidden breakpoint, setting
address@hidden buffering, input/output
address@hidden buffering, interactive vs.@: noninteractive
address@hidden buffers, flushing
address@hidden buffers, operators for
address@hidden bug reports, email address, @code{bug-gawk@@gnu.org}
address@hidden built-in functions, evaluation order
address@hidden call stack, display in debugger
address@hidden caret (@code{^}), @code{^=} operator
address@hidden caret (@code{^}), @code{^} operator
address@hidden caret (@code{^}), in bracket expressions
address@hidden caret (@code{^}), regexp operator
address@hidden case sensitivity, @command{gawk}
address@hidden case sensitivity, array indices and
address@hidden case sensitivity, converting case
address@hidden case sensitivity, example programs
address@hidden case sensitivity, regexps and
address@hidden case sensitivity, string comparisons and
address@hidden characters, counting
address@hidden characters, transliterating
address@hidden characters, values of as numbers
address@hidden colon (@code{:}), @code{?:} operator
address@hidden columns, aligning
address@hidden columns, cutting
address@hidden comma (@code{,}), in range patterns
address@hidden command completion, in debugger
address@hidden command line, @code{FS} address@hidden setting
address@hidden command line, arguments
address@hidden command line, directories on
address@hidden command line, formats
address@hidden command line, invoking @command{awk} from
address@hidden command line, option @option{-f}
address@hidden command line, options
address@hidden command line, options, end of
address@hidden command line, address@hidden assigning on
address@hidden command-line options, processing
address@hidden command-line options, string extraction
address@hidden commenting, backslash continuation and
address@hidden common extensions, @code{**=} operator
address@hidden common extensions, @code{**} operator
address@hidden common extensions, @code{/dev/stderr} special file
address@hidden common extensions, @code{/dev/stdin} special file
address@hidden common extensions, @code{/dev/stdout} special file
address@hidden common extensions, @code{BINMODE} variable
address@hidden common extensions, @code{RS} as a regexp
address@hidden common extensions, @code{\x} escape sequence
address@hidden common extensions, @code{delete} to delete entire arrays
address@hidden common extensions, @code{func} keyword
address@hidden common extensions, @code{length()} applied to an array
address@hidden common extensions, single character fields
address@hidden comparison expressions, as patterns
address@hidden comparison expressions, string vs.@: regexp
address@hidden compatibility mode (@command{gawk}), extensions
address@hidden compatibility mode (@command{gawk}), file names
address@hidden compatibility mode (@command{gawk}), hexadecimal numbers
address@hidden compatibility mode (@command{gawk}), octal numbers
address@hidden compatibility mode (@command{gawk}), specifying
address@hidden complement, bitwise
address@hidden component names, naming rules
address@hidden configuration option, @code{--disable-extensions}
address@hidden configuration option, @code{--disable-lint}
address@hidden configuration option, @code{--disable-mpfr}
address@hidden configuration option, @code{--disable-nls}
address@hidden configuration option, @code{--enable-versioned-extension-dir}
address@hidden constants, nondecimal
address@hidden constants, numeric
address@hidden constants, types of
address@hidden continue program, in debugger
address@hidden converting, dates to timestamps
address@hidden converting, numbers to strings
address@hidden converting, strings to numbers
address@hidden coprocesses, @code{getline} from
address@hidden coprocesses, closing
address@hidden currency symbols, localization
address@hidden current namespace, pushing and popping
address@hidden dark corner, @code{"0"} is actually true
address@hidden dark corner, @code{/=} operator vs. @code{/address@hidden/}
regexp constant
address@hidden dark corner, @code{ARGV} variable, value of
address@hidden dark corner, @code{CONVFMT} variable
address@hidden dark corner, @code{FILENAME} variable
address@hidden dark corner, @code{FNR}/@code{NR} variables
address@hidden dark corner, @code{FS} as null string
address@hidden dark corner, @code{NF} variable, decrementing
address@hidden dark corner, @code{OFMT} variable
address@hidden dark corner, @code{^}, in @code{FS}
address@hidden dark corner, @code{break} statement
address@hidden dark corner, @code{close()} function
address@hidden dark corner, @code{continue} statement
address@hidden dark corner, @code{exit} statement
address@hidden dark corner, @code{length()} function
address@hidden dark corner, @code{split()} function
address@hidden dark corner, array subscripts
address@hidden dark corner, command-line arguments
address@hidden dark corner, empty programs
address@hidden dark corner, escape sequences
address@hidden dark corner, escape sequences, for metacharacters
address@hidden dark corner, field separators
address@hidden dark corner, format-control characters
address@hidden dark corner, input files
address@hidden dark corner, invoking @command{awk}
address@hidden dark corner, locale's decimal point character
address@hidden dark corner, multiline records
address@hidden dark corner, range patterns, line continuation and
address@hidden dark corner, regexp as second argument to @code{index()}
address@hidden dark corner, regexp constants
address@hidden dark corner, regexp constants, @code{/=} operator and
address@hidden dark corner, regexp constants, as arguments to user-defined
functions
address@hidden dark corner, string continuation
address@hidden dark corner, strings, storing
address@hidden dark corner, value of @code{ARGV[0]}
address@hidden data, fixed-width
address@hidden database, address@hidden reading
address@hidden database, address@hidden reading
address@hidden dates, converting to timestamps
address@hidden dates, information related address@hidden localization
address@hidden debugger commands, @code{backtrace}
address@hidden debugger commands, @code{break}
address@hidden debugger commands, @code{bt} (@code{backtrace})
address@hidden debugger commands, @code{b} (@code{break})
address@hidden debugger commands, @code{clear}
address@hidden debugger commands, @code{commands}
address@hidden debugger commands, @code{condition}
address@hidden debugger commands, @code{continue}
address@hidden debugger commands, @code{c} (@code{continue})
address@hidden debugger commands, @code{delete}
address@hidden debugger commands, @code{disable}
address@hidden debugger commands, @code{display}
address@hidden debugger commands, @code{down}
address@hidden debugger commands, @code{dump}
address@hidden debugger commands, @code{d} (@code{delete})
address@hidden debugger commands, @code{enable}
address@hidden debugger commands, @code{end}
address@hidden debugger commands, @code{eval}
address@hidden debugger commands, @code{e} (@code{enable})
address@hidden debugger commands, @code{finish}
address@hidden debugger commands, @code{frame}
address@hidden debugger commands, @code{f} (@code{frame})
address@hidden debugger commands, @code{help}
address@hidden debugger commands, @code{h} (@code{help})
address@hidden debugger commands, @code{ignore}
address@hidden debugger commands, @code{info}
address@hidden debugger commands, @code{i} (@code{info})
address@hidden debugger commands, @code{list}
address@hidden debugger commands, @code{l} (@code{list})
address@hidden debugger commands, @code{nexti}
address@hidden debugger commands, @code{next}
address@hidden debugger commands, @code{ni} (@code{nexti})
address@hidden debugger commands, @code{n} (@code{next})
address@hidden debugger commands, @code{option}
address@hidden debugger commands, @code{o} (@code{option})
address@hidden debugger commands, @code{printf}
address@hidden debugger commands, @code{print}
address@hidden debugger commands, @code{p} (@code{print})
address@hidden debugger commands, @code{quit}
address@hidden debugger commands, @code{q} (@code{quit})
address@hidden debugger commands, @code{return}
address@hidden debugger commands, @code{run}
address@hidden debugger commands, @code{r} (@code{run})
address@hidden debugger commands, @code{set}
address@hidden debugger commands, @code{silent}
address@hidden debugger commands, @code{si} (@code{stepi})
address@hidden debugger commands, @code{stepi}
address@hidden debugger commands, @code{step}
address@hidden debugger commands, @code{s} (@code{step})
address@hidden debugger commands, @code{tbreak}
address@hidden debugger commands, @code{trace}
address@hidden debugger commands, @code{t} (@code{tbreak})
address@hidden debugger commands, @code{undisplay}
address@hidden debugger commands, @code{until}
address@hidden debugger commands, @code{unwatch}
address@hidden debugger commands, @code{up}
address@hidden debugger commands, @code{u} (@code{until})
address@hidden debugger commands, @code{watch}
address@hidden debugger commands, @code{where} (@code{backtrace})
address@hidden debugger commands, @code{w} (@code{watch})
address@hidden debugger, @code{backtrace} command
address@hidden debugger, @code{breakpoint} command
address@hidden debugger, @code{break} command
address@hidden debugger, @code{bt} command
address@hidden debugger, @code{b} command
address@hidden debugger, @code{next} command
address@hidden debugger, @code{n} command
address@hidden debugger, @code{print} command
address@hidden debugger, @code{p} command
address@hidden debugger, @code{run} command
address@hidden debugger, command completion
address@hidden debugger, concepts
address@hidden debugger, default list amount
address@hidden debugger, history expansion
address@hidden debugger, history file
address@hidden debugger, history size
address@hidden debugger, how to start
address@hidden debugger, instruction tracing
address@hidden debugger, interaction with namespaces
address@hidden debugger, limitations
address@hidden debugger, options
address@hidden debugger, printing all array elements
address@hidden debugger, printing single array elements
address@hidden debugger, prompt
address@hidden debugger, read commands from a file
address@hidden debugger, repeating commands
address@hidden debugger, running the program
address@hidden debugger, save commands to a file
address@hidden debugger, setting a breakpoint
address@hidden debugger, stack frames, showing
address@hidden debugging @command{gawk}, bug reports
address@hidden debugging, example session
address@hidden decimal point character, locale specific
address@hidden delete breakpoint, at location
address@hidden delete breakpoint, by number
address@hidden describe call stack frame, in debugger
address@hidden differences in @command{awk} and @command{gawk},
@code{ARGC}/@code{ARGV} variables
address@hidden differences in @command{awk} and @command{gawk}, @code{ARGIND}
variable
address@hidden differences in @command{awk} and @command{gawk},
@code{AWKLIBPATH} environment variable
address@hidden differences in @command{awk} and @command{gawk},
@code{BEGINFILE}/@code{ENDFILE} patterns
address@hidden differences in @command{awk} and @command{gawk},
@code{BEGIN}/@code{END} patterns
address@hidden differences in @command{awk} and @command{gawk}, @code{BINMODE}
variable
address@hidden differences in @command{awk} and @command{gawk}, @code{ERRNO}
variable
address@hidden differences in @command{awk} and @command{gawk},
@code{FIELDWIDTHS} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{FPAT}
variable
address@hidden differences in @command{awk} and @command{gawk}, @code{FUNCTAB}
variable
address@hidden differences in @command{awk} and @command{gawk},
@code{IGNORECASE} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{LINT}
variable
address@hidden differences in @command{awk} and @command{gawk}, @code{PROCINFO}
array
address@hidden differences in @command{awk} and @command{gawk},
@code{RS}/@code{RT} variables
address@hidden differences in @command{awk} and @command{gawk}, @code{SYMTAB}
variable
address@hidden differences in @command{awk} and @command{gawk},
@code{TEXTDOMAIN} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{close()}
function
address@hidden differences in @command{awk} and @command{gawk}, @code{getline}
command
address@hidden differences in @command{awk} and @command{gawk}, @code{length()}
function
address@hidden differences in @command{awk} and @command{gawk}, @code{match()}
function
address@hidden differences in @command{awk} and @command{gawk},
@code{print}/@code{printf} statements
address@hidden differences in @command{awk} and @command{gawk}, @code{split()}
function
address@hidden differences in @command{awk} and @command{gawk}, @env{AWKPATH}
environment variable
address@hidden differences in @command{awk} and @command{gawk}, array elements,
deleting
address@hidden differences in @command{awk} and @command{gawk}, command-line
directories
address@hidden differences in @command{awk} and @command{gawk}, error messages
address@hidden differences in @command{awk} and @command{gawk}, function
arguments (@command{gawk})
address@hidden differences in @command{awk} and @command{gawk}, implementation
limitations
address@hidden differences in @command{awk} and @command{gawk}, indirect
function calls
address@hidden differences in @command{awk} and @command{gawk}, input/output
operators
address@hidden differences in @command{awk} and @command{gawk}, line
continuations
address@hidden differences in @command{awk} and @command{gawk}, read timeouts
address@hidden differences in @command{awk} and @command{gawk}, record
separators
address@hidden differences in @command{awk} and @command{gawk}, regexp constants
address@hidden differences in @command{awk} and @command{gawk}, regular
expressions
address@hidden differences in @command{awk} and @command{gawk}, retrying input
address@hidden differences in @command{awk} and @command{gawk},
single-character fields
address@hidden differences in @command{awk} and @command{gawk}, strings
address@hidden differences in @command{awk} and @command{gawk}, strings, storing
address@hidden differences in @command{awk} and @command{gawk}, trunc-mod
operation
address@hidden directories, command-line
address@hidden directories, searching
address@hidden directories, searching for loadable extensions
address@hidden directories, searching for source files
address@hidden documentation, of @command{awk} programs
address@hidden documentation, online
address@hidden dollar sign (@code{$}), @code{$} field operator
address@hidden dollar sign (@code{$}), incrementing fields and arrays
address@hidden dollar sign (@code{$}), regexp operator
address@hidden double quote (@code{"}), in regexp constants
address@hidden double quote (@code{"}), in shell commands
address@hidden elements in arrays, assigning values
address@hidden elements in arrays, deleting
address@hidden elements in arrays, order of access by @code{in} operator
address@hidden elements in arrays, scanning
address@hidden email address for bug reports, @code{bug-gawk@@gnu.org}
address@hidden environment variables, in @code{ENVIRON} array
address@hidden epoch, definition of
address@hidden equals sign (@code{=}), @code{==} operator
address@hidden equals sign (@code{=}), @code{=} operator
address@hidden error handling, @code{ERRNO} variable and
address@hidden escape processing, @code{gsub()}/@code{gensub()}/@code{sub()}
functions
address@hidden escape sequences, in strings
address@hidden evaluate expressions, in debugger
address@hidden evaluation order, concatenation
address@hidden evaluation order, functions
address@hidden exclamation point (@code{!}), @code{!=} operator
address@hidden exclamation point (@code{!}), @code{!} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden exit status, of @command{gawk}
address@hidden exit status, of @command{gawk}, on VMS
address@hidden expressions, Boolean
address@hidden expressions, as patterns
address@hidden expressions, assignment
address@hidden expressions, comparison
address@hidden expressions, conditional
address@hidden expressions, matching @seeentry{comparison expressions}
address@hidden expressions, selecting
address@hidden extension API, version number
address@hidden extensions, @command{mawk}
address@hidden extensions, Brian Kernighan's @command{awk}
address@hidden extensions, allocating memory
address@hidden extensions, array manipulation in
address@hidden extensions, address@hidden @code{**=} operator
address@hidden extensions, address@hidden @code{**} operator
address@hidden extensions, address@hidden @code{/dev/stderr} special file
address@hidden extensions, address@hidden @code{/dev/stdin} special file
address@hidden extensions, address@hidden @code{/dev/stdout} special file
address@hidden extensions, address@hidden @code{BINMODE} variable
address@hidden extensions, address@hidden @code{RS} as a regexp
address@hidden extensions, address@hidden @code{\x} escape sequence
address@hidden extensions, address@hidden @code{delete} to delete entire arrays
address@hidden extensions, address@hidden @code{fflush()} function
address@hidden extensions, address@hidden @code{func} keyword
address@hidden extensions, address@hidden @code{length()} applied to an array
address@hidden extensions, address@hidden single character fields
address@hidden extensions, in @command{gawk}, not in POSIX @command{awk}
address@hidden extensions, loading, @code{@@load} directive
address@hidden extensions, where to find
address@hidden extraction, of marked strings (internationalization)
address@hidden false, logical
address@hidden features, adding to @command{gawk}
address@hidden features, deprecated
address@hidden features, undocumented
address@hidden field separator, POSIX and
address@hidden field separator, backslash (@code{\}) as
address@hidden field separator, in multiline records
address@hidden field separator, on command line
address@hidden field separators, @code{FIELDWIDTHS} variable and
address@hidden field separators, @code{FPAT} variable and
address@hidden field separators, choice of
address@hidden field separators, regular expressions as
address@hidden field separators, spaces as
address@hidden field separators, whitespace as
address@hidden fields, adding
address@hidden fields, changing contents of
address@hidden fields, cutting
address@hidden fields, examining
address@hidden fields, number of
address@hidden fields, numbers
address@hidden fields, printing
address@hidden fields, separating
address@hidden fields, single-character
address@hidden file inclusion, @code{@@include} directive
address@hidden file names, assignments as
address@hidden file names, distinguishing
address@hidden file names, in compatibility mode
address@hidden file names, standard streams in @command{gawk}
address@hidden files, @code{.gmo}
address@hidden files, @code{.gmo}, specifying directory of
address@hidden files, @code{.mo}, converting from @code{.po}
address@hidden files, @code{.pot}
address@hidden files, @code{.po}
address@hidden files, @code{.po}, converting to @code{.mo}
address@hidden files, @code{/dev/@dots{}} special files
address@hidden files, @code{/inet/@dots{}} (@command{gawk})
address@hidden files, @code{/inet4/@dots{}} (@command{gawk})
address@hidden files, @code{/inet6/@dots{}} (@command{gawk})
address@hidden files, @code{awkprof.out}
address@hidden files, @command{awk} programs in
address@hidden files, @file{awkvars.out}
address@hidden files, address@hidden extracting programs from
address@hidden files, closing
address@hidden files, descriptors @seeentry{file descriptors}
address@hidden files, group
address@hidden files, initialization and cleanup
address@hidden files, input @seeentry{input files}
address@hidden files, address@hidden timestamps in
address@hidden files, managing
address@hidden files, managing, data file boundaries
address@hidden files, message object
address@hidden files, message object, converting from portable object files
address@hidden files, message object, specifying directory of
address@hidden files, multiple passes over
address@hidden files, address@hidden duplicating output into
address@hidden files, output @seeentry{output files}
address@hidden files, password
address@hidden files, portable object
address@hidden files, portable object template
address@hidden files, portable object, converting to message object files
address@hidden files, portable object, generating
address@hidden files, address@hidden @code{ARGIND} variable and
address@hidden files, reading
address@hidden files, reading, multiline records
address@hidden files, searching for regular expressions
address@hidden files, skipping
address@hidden files, address@hidden search path for
address@hidden files, splitting
address@hidden floating-point, VAX/VMS
address@hidden floating-point, numbers
address@hidden floating-point, address@hidden arbitrary-precision
address@hidden floating-point, address@hidden double-precision
address@hidden floating-point, address@hidden single-precision
address@hidden format specifiers, @code{printf} statement
address@hidden format specifiers, @code{strftime()} function (@command{gawk})
address@hidden format specifiers, mixing regular with positional specifiers
address@hidden forward slash (@code{/}), @code{/=} operator
address@hidden forward slash (@code{/}), @code{/=} operator, vs.
@code{/address@hidden/} regexp constant
address@hidden forward slash (@code{/}), @code{/} operator
address@hidden forward slash (@code{/}), patterns and
address@hidden function calls, indirect
address@hidden function calls, indirect, @code{@@}-notation for
address@hidden functions, arrays as parameters to
address@hidden functions, built-in
address@hidden functions, built-in, evaluation order
address@hidden functions, defining
address@hidden functions, library
address@hidden functions, library, C library
address@hidden functions, library, Cliff random numbers
address@hidden functions, library, assertions
address@hidden functions, library, associative arrays and
address@hidden functions, library, character values as numbers
address@hidden functions, library, command-line options
address@hidden functions, library, example program for using
address@hidden functions, library, group address@hidden reading
address@hidden functions, library, managing data files
address@hidden functions, library, managing time
address@hidden functions, library, merging arrays into strings
address@hidden functions, library, rounding numbers
address@hidden functions, library, user address@hidden reading
address@hidden functions, names of
address@hidden functions, recursive
address@hidden functions, string-translation
address@hidden functions, undefined
address@hidden functions, user-defined
address@hidden functions, user-defined, @code{next}/@code{nextfile} statements
and
address@hidden functions, user-defined, calling
address@hidden functions, user-defined, address@hidden in a profile
address@hidden functions, user-defined, library of
address@hidden group database, reading
address@hidden history expansion, in debugger
address@hidden hyphen (@code{-}), @code{--} operator
address@hidden hyphen (@code{-}), @code{-=} operator
address@hidden hyphen (@code{-}), @code{-} operator
address@hidden hyphen (@code{-}), file names beginning with
address@hidden hyphen (@code{-}), in bracket expressions
address@hidden implementation issues, @command{gawk}
address@hidden implementation issues, @command{gawk}, debugging
address@hidden implementation issues, @command{gawk}, limits
address@hidden including files, @code{@@include} directive
address@hidden indirect function calls, @code{@@}-notation
address@hidden initialization, automatic
address@hidden input files, closing
address@hidden input files, counting elements in
address@hidden input files, examples
address@hidden input files, reading
address@hidden input files, running @command{awk} without
address@hidden input files, variable assignments and
address@hidden input record, length of
address@hidden input, address@hidden nondecimal
address@hidden input, explicit
address@hidden input, files @seeentry{input files}
address@hidden input, multiline records
address@hidden input, splitting into records
address@hidden input, standard
address@hidden input/output, binary
address@hidden input/output, from @code{BEGIN} and @code{END}
address@hidden input/output, two-way
address@hidden insomnia, cure for
address@hidden installation, VMS
address@hidden instruction tracing, in debugger
address@hidden integers, arbitrary precision
address@hidden integers, unsigned
address@hidden internationalization, localization
address@hidden internationalization, localization, @command{gawk} and
address@hidden internationalization, localization, character classes
address@hidden internationalization, localization, locale categories
address@hidden internationalization, localization, marked strings
address@hidden internationalization, localization, portability and
address@hidden interval expressions, regexp operator
address@hidden knights, jedi
address@hidden left angle bracket (@code{<}), @code{<=} operator
address@hidden left angle bracket (@code{<}), @code{<} operator
address@hidden left angle bracket (@code{<}), @code{<} operator (I/O)
address@hidden left shift, bitwise
address@hidden libraries of @command{awk} functions, assertions
address@hidden libraries of @command{awk} functions, associative arrays and
address@hidden libraries of @command{awk} functions, character values as numbers
address@hidden libraries of @command{awk} functions, command-line options
address@hidden libraries of @command{awk} functions, example program for using
address@hidden libraries of @command{awk} functions, group database, reading
address@hidden libraries of @command{awk} functions, managing, data files
address@hidden libraries of @command{awk} functions, managing, time
address@hidden libraries of @command{awk} functions, merging arrays into strings
address@hidden libraries of @command{awk} functions, rounding numbers
address@hidden libraries of @command{awk} functions, user database, reading
address@hidden line continuations, @command{gawk}
address@hidden line continuations, in @code{print} statement
address@hidden line continuations, with C shell
address@hidden lines, address@hidden printing
address@hidden lines, counting
address@hidden lines, address@hidden removing
address@hidden lines, matching ranges of
address@hidden lines, skipping between markers
address@hidden lint checking, @env{POSIXLY_CORRECT} environment variable
address@hidden lint checking, array elements
address@hidden lint checking, array subscripts
address@hidden lint checking, empty programs
address@hidden lint checking, issuing warnings
address@hidden lint checking, undefined functions
address@hidden list all global variables, in debugger
address@hidden list function definitions, in debugger
address@hidden loading extensions, @code{@@load} directive
address@hidden local variables, in a function
address@hidden locale, definition of
address@hidden log files, timestamps in
address@hidden loops, @code{break} statement and
address@hidden loops, @code{continue} statements and
address@hidden loops, @address@hidden
address@hidden loops, @code{for}, array scanning
address@hidden loops, @code{for}, iterative
address@hidden loops, @code{while}
address@hidden loops, count for address@hidden in a profile
address@hidden loops, exiting
address@hidden mailing list, GNITS
address@hidden matching, expressions @seeentry{comparison expressions}
address@hidden matching, leftmost longest
address@hidden matching, null strings
address@hidden memory, allocating for extensions
address@hidden message object files, converting from portable object files
address@hidden message object files, specifying directory of
address@hidden metacharacters, escape sequences for
address@hidden module, definition of
address@hidden monetary information, localization
address@hidden names, arrays/variables
address@hidden names, functions
address@hidden namespace issues, functions
address@hidden namespace names, naming rules
address@hidden namespace, @code{awk}
address@hidden namespace, default
address@hidden namespace, definition of
address@hidden namespace, example code
address@hidden namespace, implicit
address@hidden namespace, pushing and popping
address@hidden namespace, standard @command{awk}, global
address@hidden namespaces, backwards compatibility
address@hidden namespaces, changing
address@hidden namespaces, interaction with debugger
address@hidden namespaces, interaction with extension API
address@hidden namespaces, interaction with pretty printer
address@hidden namespaces, interaction with profiler
address@hidden namespaces, qualified names
address@hidden naming rules, namespaces and component names
address@hidden networks, programming
address@hidden networks, support for
address@hidden newlines, as record separators
address@hidden newlines, in dynamic regexps
address@hidden newlines, in regexp constants
address@hidden newlines, printing
address@hidden newlines, separating statements in actions
address@hidden null strings in @command{gawk} arguments, quoting and
address@hidden null strings, as array subscripts
address@hidden null strings, converting numbers to strings
address@hidden null strings, deleting array elements and
address@hidden null strings, matching
address@hidden number sign (@code{#}), @code{#!} (executable scripts)
address@hidden number sign (@code{#}), commenting
address@hidden numbers, Cliff random
address@hidden numbers, as array subscripts
address@hidden numbers, as string of bits
address@hidden numbers, as values of characters
address@hidden numbers, converting
address@hidden numbers, converting, to strings
address@hidden numbers, hexadecimal
address@hidden numbers, octal
address@hidden numbers, rounding
address@hidden numeric, output format
address@hidden numeric, strings
address@hidden operating systems, BSD-based
address@hidden operating systems, address@hidden @command{gawk} on
address@hidden operating systems, address@hidden @command{gawk} on, installing
address@hidden operating systems, porting @command{gawk} to
address@hidden operations, bitwise
address@hidden operators, Boolean @seeentry{Boolean expressions}
address@hidden operators, GNU-specific
address@hidden operators, arithmetic
address@hidden operators, assignment
address@hidden operators, assignment, evaluation order
address@hidden operators, decrement/increment
address@hidden operators, input/output
address@hidden operators, logical @seeentry{Boolean expressions}
address@hidden operators, precedence
address@hidden operators, precedence of
address@hidden operators, relational @address@hidden comparison}
address@hidden operators, short-circuit
address@hidden operators, string
address@hidden operators, string-matching
address@hidden operators, string-matching, for buffers
address@hidden operators, word-boundary (@command{gawk})
address@hidden options, command-line
address@hidden options, command-line, end of
address@hidden options, command-line, invoking @command{awk}
address@hidden options, command-line, processing
address@hidden options, deprecated
address@hidden options, long
address@hidden options, printing list of
address@hidden order of evaluation, concatenation
address@hidden output, buffering
address@hidden output, duplicating into files
address@hidden output, address@hidden closing
address@hidden output, format address@hidden @code{OFMT}
address@hidden output, formatted
address@hidden output, pipes
address@hidden output, printing @seeentry{printing}
address@hidden output, records
address@hidden output, standard
address@hidden package, definition of
address@hidden parentheses @code{()}, in a profile
address@hidden parentheses @code{()}, regexp operator
address@hidden patterns, Boolean expressions as
address@hidden patterns, comparison expressions as
address@hidden patterns, counts, in a profile
address@hidden patterns, default
address@hidden patterns, empty
address@hidden patterns, expressions as
address@hidden patterns, ranges in
address@hidden patterns, regexp constants as
address@hidden patterns, regular expressions as
address@hidden patterns, types of
address@hidden percent sign (@code{%}), @code{%=} operator
address@hidden percent sign (@code{%}), @code{%} operator
address@hidden period (@code{.}), regexp operator
address@hidden pipe, closing
address@hidden pipe, input
address@hidden pipe, output
address@hidden plus sign (@code{+}), @code{++} operator
address@hidden plus sign (@code{+}), @code{+=} operator
address@hidden plus sign (@code{+}), @code{+} operator
address@hidden plus sign (@code{+}), regexp operator
address@hidden portability, @code{#!} (executable scripts)
address@hidden portability, @code{**=} operator and
address@hidden portability, @code{**} operator and
address@hidden portability, @code{ARGV} variable
address@hidden portability, @code{NF} address@hidden decrementing
address@hidden portability, @code{close()} function and
address@hidden portability, @code{length()} function
address@hidden portability, @code{next} statement in user-defined functions
address@hidden portability, @code{substr()} function
address@hidden portability, @command{gawk}
address@hidden portability, @command{gettext} library and
address@hidden portability, @env{POSIXLY_CORRECT} environment variable
address@hidden portability, backslash continuation and
address@hidden portability, backslash in escape sequences
address@hidden portability, data files as single record
address@hidden portability, deleting array elements
address@hidden portability, example programs
address@hidden portability, address@hidden defining
address@hidden portability, internationalization and
address@hidden portability, new @command{awk} vs.@: old @command{awk}
address@hidden portability, operators
address@hidden portability, operators, not in POSIX @command{awk}
address@hidden portable object files, converting to message object files
address@hidden portable object files, generating
address@hidden positional specifiers, @code{printf} statement
address@hidden positional specifiers, @code{printf} statement, mixing with
regular formats
address@hidden precedence, regexp operators
address@hidden predefined variables, @code{-v} address@hidden setting with
address@hidden predefined variables, conveying information
address@hidden predefined variables, user-modifiable
address@hidden pretty printer, interaction with namespaces
address@hidden pretty-printing, address@hidden difference with
address@hidden print variables, in debugger
address@hidden printing, list of options
address@hidden printing, mailing labels
address@hidden printing, unduplicated lines of text
address@hidden printing, user information
address@hidden processes, two-way communications with
address@hidden profiler, interaction with namespaces
address@hidden profiling @command{awk} programs, dynamically
address@hidden profiling, address@hidden difference with
address@hidden program, definition of
address@hidden programmers, attractiveness of
address@hidden programming conventions, @code{--non-decimal-data} option
address@hidden programming conventions, @code{ARGC}/@code{ARGV} variables
address@hidden programming conventions, @code{exit} statement
address@hidden programming conventions, @command{gawk} extensions
address@hidden programming conventions, function parameters
address@hidden programming conventions, functions, calling
address@hidden programming conventions, functions, writing
address@hidden programming conventions, private variable names
address@hidden programming language, recipe for
address@hidden programming languages, Ada
address@hidden programming languages, Go
address@hidden programming languages, Java
address@hidden programming, basic steps
address@hidden programming, concepts
address@hidden qualified name, definition of
address@hidden qualified name, use of
address@hidden question mark (@code{?}), @code{?:} operator
address@hidden question mark (@code{?}), regexp operator
address@hidden quoting, for small awk programs
address@hidden quoting, in @command{gawk} command lines
address@hidden quoting, in @command{gawk} command lines, tricks for
address@hidden random numbers, @code{rand()}/@code{srand()} functions
address@hidden random numbers, Cliff
address@hidden random numbers, seed of
address@hidden range patterns, line continuation and
address@hidden record separators, changing
address@hidden record separators, newlines as
address@hidden record separators, regular expressions as
address@hidden record separators, with multiline records
address@hidden records, multiline
address@hidden records, printing
address@hidden records, splitting input into
address@hidden records, terminating
address@hidden records, treating files as
address@hidden redirect @command{gawk} output, in debugger
address@hidden reference counting, sorting arrays
address@hidden regexp constants, @code{/address@hidden/}, @code{/=} operator and
address@hidden regexp constants, as patterns
address@hidden regexp constants, in @command{gawk}
address@hidden regexp constants, slashes vs.@: quotes
address@hidden regexp constants, vs.@: string constants
address@hidden regular expressions, @command{gawk}, command-line options
address@hidden regular expressions, anchors in
address@hidden regular expressions, as field separators
address@hidden regular expressions, as patterns
address@hidden regular expressions, as record separators
address@hidden regular expressions, case sensitivity
address@hidden regular expressions, computed
address@hidden regular expressions, constants @seeentry{regexp constants}
address@hidden regular expressions, dynamic
address@hidden regular expressions, dynamic, with embedded newlines
address@hidden regular expressions, interval expressions and
address@hidden regular expressions, leftmost longest match
address@hidden regular expressions, operators
address@hidden regular expressions, operators, @command{gawk}
address@hidden regular expressions, operators, for buffers
address@hidden regular expressions, operators, for words
address@hidden regular expressions, operators, precedence of
address@hidden regular expressions, searching for
address@hidden right angle bracket (@code{>}), @code{>=} operator
address@hidden right angle bracket (@code{>}), @code{>>} operator (I/O)
address@hidden right angle bracket (@code{>}), @code{>} operator
address@hidden right angle bracket (@code{>}), @code{>} operator (I/O)
address@hidden right shift, bitwise
address@hidden rule, definition of
address@hidden search paths, for loadable extensions
address@hidden search paths, for source files
address@hidden searching, files for regular expressions
address@hidden searching, for words
address@hidden semicolon (@code{;}), @env{AWKPATH} variable and
address@hidden semicolon (@code{;}), separating rules
address@hidden semicolon (@code{;}), separating statements in actions
address@hidden separators, field
address@hidden separators, field, @code{FIELDWIDTHS} variable and
address@hidden separators, field, @code{FPAT} variable and
address@hidden separators, for records
address@hidden separators, for records, regular expressions as
address@hidden separators, for statements in actions
address@hidden separators, subscript
address@hidden shell quoting, rules for
address@hidden shells, piping commands into
address@hidden shells, quoting
address@hidden shells, quoting, rules for
address@hidden shells, scripts
address@hidden shells, sea
address@hidden shells, variables
address@hidden shift, bitwise
address@hidden show all source files, in debugger
address@hidden show function arguments, in debugger
address@hidden show local variables, in debugger
address@hidden show name of current source file, in debugger
address@hidden side effects, @code{FILENAME} variable
address@hidden side effects, @code{asort()} function
address@hidden side effects, Boolean operators
address@hidden side effects, array indexing
address@hidden side effects, assignment expressions
address@hidden side effects, conditional expressions
address@hidden side effects, decrement/increment operators
address@hidden side effects, function calls
address@hidden side effects, statements
address@hidden signals, @code{HUP}/@code{SIGHUP}, for profiling
address@hidden signals, @code{INT}/@code{SIGINT} (MS-Windows)
address@hidden signals, @code{QUIT}/@code{SIGQUIT} (MS-Windows)
address@hidden signals, @code{USR1}/@code{SIGUSR1}, for profiling
address@hidden single quote (@code{'}), in shell commands
address@hidden single quote (@code{'}), vs.@: apostrophe
address@hidden single quote (@code{'}), with double quotes
address@hidden single records, treating files as
address@hidden single-step execution, in the debugger
address@hidden sort function, arrays, sorting
address@hidden source code, @command{awka}
address@hidden source code, @command{gawk}
address@hidden source code, @command{goawk}
address@hidden source code, @command{jawk}
address@hidden source code, @command{mawk}
address@hidden source code, @command{pawk}
address@hidden source code, @command{pawk} (Python version)
address@hidden source code, Brian Kernighan's @command{awk}
address@hidden source code, BusyBox Awk
address@hidden source code, Illumos @command{awk}
address@hidden source code, QSE @command{awk}
address@hidden source code, QuikTrim Awk
address@hidden source code, Solaris @command{awk}
address@hidden source code, libmawk
address@hidden source code, mixing
address@hidden square brackets (@code{[]}), regexp operator
address@hidden statements, address@hidden control statements and
address@hidden statements, control, in actions
address@hidden statements, multiple
address@hidden stop automatic display, in debugger
address@hidden string constants, vs.@: regexp constants
address@hidden string, regular expression match
address@hidden strings splitting, example
address@hidden strings, continuation across lines
address@hidden strings, converting
address@hidden strings, converting letter case
address@hidden strings, converting, numbers to
address@hidden strings, empty @seeentry{null strings}
address@hidden strings, extracting
address@hidden strings, for localization
address@hidden strings, length limitations
address@hidden strings, merging arrays into
address@hidden strings, null
address@hidden strings, numeric
address@hidden subscripts in arrays, multidimensional
address@hidden subscripts in arrays, multidimensional, scanning
address@hidden subscripts in arrays, numbers as
address@hidden subscripts in arrays, uninitialized variables as
address@hidden text, printing
address@hidden text, printing, unduplicated lines of
address@hidden tilde (@code{~}), @code{~} operator
address@hidden time, alarm clock example program
address@hidden time, localization and
address@hidden time, managing
address@hidden time, retrieving
address@hidden timeout, reading input
address@hidden timestamps, converting dates to
address@hidden timestamps, formatted
address@hidden traceback, display in debugger
address@hidden treating files, as single records
address@hidden troubleshooting, @code{--non-decimal-data} option
address@hidden troubleshooting, @code{==} operator
address@hidden troubleshooting, @code{fflush()} function
address@hidden troubleshooting, @code{getline} function
address@hidden troubleshooting, @code{gsub()}/@code{sub()} functions
address@hidden troubleshooting, @code{match()} function
address@hidden troubleshooting, @code{print} address@hidden omitting commas
address@hidden troubleshooting, @code{substr()} function
address@hidden troubleshooting, @code{system()} function
address@hidden troubleshooting, @command{awk} uses @code{FS} not @code{IFS}
address@hidden troubleshooting, @command{gawk}
address@hidden troubleshooting, @command{gawk}, bug reports
address@hidden troubleshooting, @command{gawk}, fatal address@hidden function
arguments
address@hidden troubleshooting, backslash before nonspecial character
address@hidden troubleshooting, division
address@hidden troubleshooting, fatal errors, @code{printf} format strings
address@hidden troubleshooting, fatal errors, field address@hidden specifying
address@hidden troubleshooting, function call syntax
address@hidden troubleshooting, printing
address@hidden troubleshooting, quotes with file names
address@hidden troubleshooting, readable data files
address@hidden troubleshooting, regexp constants vs.@: string constants
address@hidden troubleshooting, string concatenation
address@hidden troubleshooting, typographical address@hidden global variables
address@hidden true, logical
address@hidden type, of variable
address@hidden underscore (@code{_}), C macro
address@hidden underscore (@code{_}), in names of private variables
address@hidden underscore (@code{_}), translatable string
address@hidden uninitialized variables, as array subscripts
address@hidden uppercase names, namespace for
address@hidden user-defined, functions, address@hidden in a profile
address@hidden user-defined, variables
address@hidden users, information about, printing
address@hidden users, information about, retrieving
address@hidden values, numeric
address@hidden values, regexp
address@hidden values, string
address@hidden variables, @code{getline} command address@hidden using
address@hidden variables, assigning on command line
address@hidden variables, built-in
address@hidden variables, flag
address@hidden variables, global, for library functions
address@hidden variables, global, printing list of
address@hidden variables, initializing
address@hidden variables, local to a function
address@hidden variables, predefined
address@hidden variables, predefined, @code{-v} address@hidden setting with
address@hidden variables, predefined, conveying information
address@hidden variables, private
address@hidden variables, setting
address@hidden variables, shadowing
address@hidden variables, types of
address@hidden variables, types of, comparison expressions and
address@hidden variables, address@hidden as array subscripts
address@hidden variables, user-defined
address@hidden vertical bar (@code{|}), @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}), @code{||} operator
address@hidden vertical bar (@code{|}), @code{|} operator (I/O)
address@hidden warnings, issuing
address@hidden whitespace, as field separators
address@hidden whitespace, address@hidden calling
address@hidden whitespace, newlines as
address@hidden word, regexp definition of
address@hidden words, counting
address@hidden words, address@hidden searching for
address@hidden words, usage address@hidden generating
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=332f75e995bb537642759cd301b064b3e1ed6e65
commit 332f75e995bb537642759cd301b064b3e1ed6e65
Author: Arnold D. Robbins <address@hidden>
Date: Fri Mar 29 14:59:20 2019 +0300
Start on index rework.
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 902ab99..982291d 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -1330,7 +1330,7 @@ properly written @command{awk} programs should work with
@command{gawk}.
So most of the time, we don't distinguish between @command{gawk} and other
@command{awk} implementations.
address@hidden @command{awk}, POSIX and, See Also POSIX @command{awk}
address@hidden @command{awk}, POSIX and @seealso{POSIX @command{awk}}
@cindex @command{awk}, POSIX and
@cindex POSIX, @command{awk} and
@cindex @command{gawk}, @command{awk} and
@@ -1356,8 +1356,8 @@ Experiment with algorithms that you can adapt later to
other computer
languages
@end itemize
address@hidden @command{awk}, See Also @command{gawk}
address@hidden @command{gawk}, See Also @command{awk}
address@hidden @command{awk} @address@hidden
address@hidden @command{gawk} @address@hidden
@cindex @command{gawk}, uses for
In addition,
@command{gawk}
@@ -1388,7 +1388,7 @@ Unix-based systems. If you are using some other operating
system, you still need
be familiar with the ideas of I/O redirection and pipes.} as well as basic
shell
facilities, such as input/output (I/O) redirection and pipes.
address@hidden GNU @command{awk}, See @command{gawk}
address@hidden GNU @command{awk} @address@hidden
Implementations of the @command{awk} language are available for many
different computing environments. This @value{DOCUMENT}, while describing
the @command{awk} language in general, also describes the particular
@@ -1891,7 +1891,7 @@ you illuminate, there's always a smaller but darker one.}
@author Brian Kernighan
@end quotation
address@hidden d.c., See dark corner
address@hidden d.c. @seeentry{dark corner}
@cindex dark corner
Until the POSIX standard (and @address@hidden),
many features of @command{awk} were either poorly documented or not
@@ -1911,7 +1911,7 @@ They also appear in the index under the heading ``dark
corner.''
But, as noted by the opening quote, any coverage of dark
corners is by definition incomplete.
address@hidden c.e., See common extensions
address@hidden c.e. @seeentry{common extensions}
Extensions to the standard @command{awk} language that are supported by
more than one @command{awk} implementation are marked
@ifclear FOR_PRINT
@@ -1935,7 +1935,7 @@ Emacs editor. GNU Emacs is the most widely used version
of Emacs today.
@cindex GNU Project
@cindex GPL (General Public License)
address@hidden General Public License, See GPL
address@hidden General Public License @seeentry{GPL}
@cindex documentation, online
The address@hidden stands for ``GNU's Not Unix.''}
Project is an ongoing effort on the part of the Free Software
@@ -2472,7 +2472,7 @@ which usually means whatever you type on the keyboard.
This continues
until you indicate end-of-file by typing @kbd{Ctrl-d}.
(On non-POSIX operating systems, the end-of-file character may be different.)
address@hidden files, input, See input files
address@hidden files, input @seeentry{input files}
@cindex input files, running @command{awk} without
@cindex @command{awk} programs, running, without input files
As an example, the following program prints a friendly piece of advice
@@ -5130,7 +5130,7 @@ $ @kbd{awk '$1 !~ /J/' inventory-shipped}
@cindex regexp constants
@cindex constant regexps
address@hidden regular expressions, constants, See regexp constants
address@hidden regular expressions, constants @seeentry{regexp constants}
When a regexp is enclosed in slashes, such as @code{/foo/}, we call it
a @dfn{regexp constant}, much like @code{5.27} is a numeric constant and
@code{"foo"} is a string constant.
@@ -5454,9 +5454,9 @@ may not be able to match the @sc{nul} character.
@cindex @code{[]} (square brackets), regexp operator
@cindex square brackets (@code{[]}), regexp operator
@cindex bracket expressions
address@hidden character sets, See Also bracket expressions
address@hidden character lists, See bracket expressions
address@hidden character classes, See bracket expressions
address@hidden character sets @seealso{bracket expressions}
address@hidden character lists @seeentry{bracket expressions}
address@hidden character classes @seeentry{bracket expressions}
@item @address@hidden@code{]}
This is called a @dfn{bracket address@hidden other literature,
you may see a bracket expression referred to as either a
@@ -6493,7 +6493,7 @@ even if the last character in the file is not the
character in @code{RS}.
@cindex empty strings
@cindex null strings
address@hidden strings, empty, See null strings
address@hidden strings, empty @seeentry{null strings}
The empty string @code{""} (a string without any characters)
has a special meaning
as the value of @code{RS}. It means that records are separated
@@ -6857,8 +6857,8 @@ the appropriate number of field separators between it and
the previously
existing fields.
@cindex @code{OFS} variable
address@hidden output field separator, See @code{OFS} variable
address@hidden field separators, See Also @code{OFS}
address@hidden output field separator @address@hidden variable}
address@hidden field separators @address@hidden
This recomputation affects and is affected by
@code{NF} (the number of fields; @pxref{Fields}).
For example, the value of @code{NF} is set to the number of the highest
@@ -7149,7 +7149,7 @@ $ @kbd{echo ' a b c d ' | awk 'BEGIN @{ FS = "[
\t\n]+" @}}
@noindent
@cindex null strings
@cindex strings, null
address@hidden empty strings, See null strings
address@hidden empty strings @seeentry{null strings}
In this case, the first field is null, or empty.
The stripping of leading and trailing whitespace also comes into
@@ -7836,7 +7836,7 @@ example of such a function).
@cindex records, multiline
@cindex input, multiline records
@cindex files, reading, multiline records
address@hidden input, files, See input files
address@hidden input, files @seeentry{input files}
In some databases, a single line cannot conveniently hold all the
information in one entry. In such cases, you can use multiline
records. The first step in doing this is to choose your data format.
@@ -8881,7 +8881,7 @@ That can be fixed by making one simple change. What is it?
@chapter Printing Output
@cindex printing
address@hidden output, printing, See printing
address@hidden output, printing @seeentry{printing}
One of the most common programming actions is to @dfn{print}, or output,
some or all of the input. Use the @code{print} statement
for simple output, and the @code{printf} statement
@@ -9098,7 +9098,7 @@ then outputs a string called the @dfn{output record
separator} (or
makes a separate line.
@cindex output, records
address@hidden output record separator, See @code{ORS} variable
address@hidden output record separator @address@hidden variable}
@cindex @code{ORS} variable
@cindex @code{BEGIN} pattern, @code{OFS}/@code{ORS} variables, assigning
values to
In order to change how output fields and records are separated, assign
@@ -9727,8 +9727,8 @@ Redirections in @command{awk} are written just like
redirections in shell
commands, except that they are written inside the @command{awk} program.
@c the commas here are part of the see also
address@hidden @code{print} statement, See Also address@hidden of output
address@hidden @code{printf} statement, See Also address@hidden of output
address@hidden @code{print} statement @address@hidden of output}
address@hidden @code{printf} statement @address@hidden of output}
There are four forms of output redirection: output to a file, output
appended to a file, output through a pipe to another command, and output
to a coprocess. We show them all for the @code{print} statement,
@@ -9945,7 +9945,7 @@ command lines to be fed to the shell.
@cindex error output
@cindex standard error
@cindex file descriptors
address@hidden files, descriptors, See file descriptors
address@hidden files, descriptors @seeentry{file descriptors}
Running programs conventionally have three input and output streams
already available to them for reading and writing. These are known
@@ -10137,7 +10137,7 @@ Doing so results in unpredictable behavior.
@node Close Files And Pipes
@section Closing Input and Output Redirections
address@hidden files, output, See output files
address@hidden files, output @seeentry{output files}
@cindex input files, closing
@cindex output, address@hidden closing
@cindex pipe, closing
@@ -12030,10 +12030,10 @@ the string constant @code{"0"} is actually true,
because it is non-null.
@cindex comparison expressions
@cindex expressions, comparison
address@hidden expressions, matching, See comparison expressions
address@hidden matching, expressions, See comparison expressions
address@hidden relational operators, See comparison operators
address@hidden operators, relational, See address@hidden comparison
address@hidden expressions, matching @seeentry{comparison expressions}
address@hidden matching, expressions @seeentry{comparison expressions}
address@hidden relational operators @seeentry{comparison operators}
address@hidden operators, relational @address@hidden comparison}
@cindex variable typing
@cindex variables, types of, comparison expressions and
Unlike in other programming languages, in @command{awk} variables do not have a
@@ -12560,10 +12560,10 @@ and http://austingroupbugs.net/view.php?id=1070.
@cindex not Boolean-logic operator
@cindex expressions, Boolean
@cindex Boolean expressions
address@hidden operators, Boolean, See Boolean expressions
address@hidden Boolean operators, See Boolean expressions
address@hidden logical operators, See Boolean expressions
address@hidden operators, logical, See Boolean expressions
address@hidden operators, Boolean @seeentry{Boolean expressions}
address@hidden Boolean operators @seeentry{Boolean expressions}
address@hidden logical operators @seeentry{Boolean expressions}
address@hidden operators, logical @seeentry{Boolean expressions}
A @dfn{Boolean expression} is a combination of comparison expressions or
matching expressions, using the Boolean operators ``or''
@@ -13982,7 +13982,7 @@ the first thing on its line.
@cindex @code{while} statement
@cindex loops
@cindex loops, @code{while}
address@hidden loops, See Also @code{while} statement
address@hidden loops @address@hidden statement}
In programming, a @dfn{loop} is a part of a program that can
be executed two or more times in succession.
@@ -28487,7 +28487,7 @@ As a result, internationalization and localization
of programs and software systems became a common practice.
@cindex internationalization, localization
address@hidden @command{gawk}, internationalization and, See
internationalization
address@hidden @command{gawk}, internationalization and
@seeentry{internationalization}
@cindex internationalization, localization, @command{gawk} and
For many years, the ability to provide internationalization
was largely restricted to programs written in C and C++.
@@ -28514,7 +28514,7 @@ a requirement.
@section Internationalization and Localization
@cindex internationalization
address@hidden localization, See address@hidden localization
address@hidden localization @address@hidden localization}
@cindex localization
@dfn{Internationalization} means writing (or modifying) a program once,
in such a way that it can use multiple languages without requiring
@@ -37429,7 +37429,7 @@ The 2008 POSIX standard can be found online at
@node BTL
@appendixsec Extensions in Brian Kernighan's @command{awk}
address@hidden @command{awk}, versions of, See Also Brian Kernighan's
@command{awk}
address@hidden @command{awk}, versions of @seealso{Brian Kernighan's
@command{awk}}
@cindex extensions, Brian Kernighan's @command{awk}
@cindex Brian Kernighan's @command{awk}, extensions
@cindex Kernighan, Brian
@@ -39009,7 +39009,7 @@ the appropriate credit where credit is due.
@appendix Installing @command{gawk}
@c last two commas are part of see also
address@hidden operating systems, See Also GNU/address@hidden PC operating
address@hidden Unix
address@hidden operating systems @seealso{GNU/address@hidden PC operating
address@hidden Unix}
@cindex @command{gawk}, installing
@cindex installing @command{gawk}
This appendix provides instructions for installing @command{gawk} on the
@@ -40377,7 +40377,7 @@ This @value{SECTION} briefly describes where to get
them:
@table @asis
@cindex Kernighan, Brian
@cindex source code, Brian Kernighan's @command{awk}
address@hidden @command{awk}, versions of, See Also Brian Kernighan's
@command{awk}
address@hidden @command{awk}, versions of @seealso{Brian Kernighan's
@command{awk}}
@cindex Brian Kernighan's @command{awk}, source code
@item Unix @command{awk}
Brian Kernighan, one of the original designers of Unix @command{awk},
diff --git a/doc/list1 b/doc/list1
new file mode 100644
index 0000000..1ceb8cb
--- /dev/null
+++ b/doc/list1
@@ -0,0 +1,1478 @@
address@hidden @code{!} (exclamation point), @code{!=} operator
address@hidden @code{!} (exclamation point), @code{!} operator
address@hidden @code{!} (exclamation point), @code{!} operator
address@hidden @code{!} (exclamation point), @code{!~} operator
address@hidden @code{"} (double quote), in regexp constants
address@hidden @code{"} (double quote), in shell commands
address@hidden @code{#} (number sign), @code{#!} (executable scripts)
address@hidden @code{#} (number sign), commenting
address@hidden @code{$} (dollar sign), @code{$} field operator
address@hidden @code{$} (dollar sign), incrementing fields and arrays
address@hidden @code{$} (dollar sign), regexp operator
address@hidden @code{%} (percent sign), @code{%=} operator
address@hidden @code{%} (percent sign), @code{%} operator
address@hidden @code{&} (ampersand), @code{&&} operator
address@hidden @code{&} (ampersand), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden @code{'} (single quote), in shell commands
address@hidden @code{'} (single quote), vs.@: apostrophe
address@hidden @code{'} (single quote), with double quotes
address@hidden @code{()} (parentheses), in a profile
address@hidden @code{()} (parentheses), regexp operator
address@hidden @code{*} (asterisk), @code{**=} operator
address@hidden @code{*} (asterisk), @code{**} operator
address@hidden @code{*} (asterisk), @code{*=} operator
address@hidden @code{*} (asterisk), @code{*} operator, as multiplication
operator
address@hidden @code{*} (asterisk), @code{*} operator, as regexp operator
address@hidden @code{*} (asterisk), @code{*} operator, null address@hidden
matching
address@hidden @code{+} (plus sign), @code{++} operator
address@hidden @code{+} (plus sign), @code{+=} operator
address@hidden @code{+} (plus sign), @code{+} operator
address@hidden @code{+} (plus sign), regexp operator
address@hidden @code{,} (comma), in range patterns
address@hidden @code{-} (hyphen), @code{--} operator
address@hidden @code{-} (hyphen), @code{-=} operator
address@hidden @code{-} (hyphen), @code{-} operator
address@hidden @code{-} (hyphen), file names beginning with
address@hidden @code{-} (hyphen), in bracket expressions
address@hidden @code{.gmo} files, specifying directory of
address@hidden @code{.mo} files, converting from @code{.po}
address@hidden @code{.po} files, converting to @code{.mo}
address@hidden @code{.} (period), regexp operator
address@hidden @code{/} (forward slash), @code{/=} operator
address@hidden @code{/} (forward slash), @code{/=} operator, vs.
@code{/address@hidden/} regexp constant
address@hidden @code{/} (forward slash), @code{/} operator
address@hidden @code{/} (forward slash), patterns and
address@hidden @code{::}, namespace separator
address@hidden @code{:} (colon), @code{?:} operator
address@hidden @code{;} (semicolon), @env{AWKPATH} variable and
address@hidden @code{;} (semicolon), separating rules
address@hidden @code{;} (semicolon), separating statements in actions
address@hidden @code{<} (left angle bracket), @code{<=} operator
address@hidden @code{<} (left angle bracket), @code{<} operator
address@hidden @code{<} (left angle bracket), @code{<} operator (I/O)
address@hidden @code{=} (equals sign), @code{==} operator
address@hidden @code{=} (equals sign), @code{=} operator
address@hidden @code{>} (right angle bracket), @code{>=} operator
address@hidden @code{>} (right angle bracket), @code{>>} operator (I/O)
address@hidden @code{>} (right angle bracket), @code{>} operator
address@hidden @code{>} (right angle bracket), @code{>} operator (I/O)
address@hidden @code{?} (question mark), @code{?:} operator
address@hidden @code{?} (question mark), regexp operator
address@hidden @code{@@namespace}, no effect on @address@hidden @address@hidden
@address@hidden and @code{ENDFILE}
address@hidden @address@hidden@}} (braces), actions and
address@hidden @address@hidden@}} (braces), statements, grouping
address@hidden @code{ARGC}/@code{ARGV} variables, command-line arguments
address@hidden @code{ARGC}/@code{ARGV} variables, how to use
address@hidden @code{ARGC}/@code{ARGV} variables, portability and
address@hidden @code{ARGIND} variable, command-line arguments
address@hidden @code{ARGV} array, indexing into
address@hidden @code{BEGINFILE} pattern, Boolean patterns and
address@hidden @code{BEGINFILE} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{BEGIN} pattern, @code{OFS}/@code{ORS} variables, assigning
values to
address@hidden @code{BEGIN} pattern, @code{TEXTDOMAIN} variable and
address@hidden @code{BEGIN} pattern, @code{assert()} user-defined function and
address@hidden @code{BEGIN} pattern, @code{exit} statement and
address@hidden @code{BEGIN} pattern, @code{getline} and
address@hidden @code{BEGIN} pattern, @code{next}/@code{nextfile} statements and
address@hidden @code{BEGIN} pattern, @code{print} statement and
address@hidden @code{BEGIN} pattern, @code{pwcat} program
address@hidden @code{BEGIN} pattern, Boolean patterns and
address@hidden @code{BEGIN} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{BEGIN} pattern, address@hidden adding
address@hidden @code{BEGIN} pattern, operators and
address@hidden @code{BEGIN} pattern, profiling and
address@hidden @code{BEGIN} pattern, running @command{awk} programs and
address@hidden @code{CONVFMT} variable, array subscripts and
address@hidden @code{ENDFILE} pattern, Boolean patterns and
address@hidden @code{ENDFILE} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{END} pattern, @code{assert()} user-defined function and
address@hidden @code{END} pattern, @code{exit} statement and
address@hidden @code{END} pattern, @code{next}/@code{nextfile} statements and
address@hidden @code{END} pattern, @code{print} statement and
address@hidden @code{END} pattern, Boolean patterns and
address@hidden @code{END} pattern, execution order not affected by
@code{@@namespace}
address@hidden @code{END} pattern, operators and
address@hidden @code{END} pattern, profiling and
address@hidden @code{ERRNO} variable, with @code{BEGINFILE} pattern
address@hidden @code{ERRNO} variable, with @command{close()} function
address@hidden @code{ERRNO} variable, with @command{getline} command
address@hidden @code{FILENAME} variable, @address@hidden setting with
address@hidden @code{FNR} variable, changing
address@hidden @code{FS} variable, @code{--field-separator} option and
address@hidden @code{FS} variable, TAB character as
address@hidden @code{FS} variable, as null string
address@hidden @code{FS} variable, changing value of
address@hidden @code{FS} variable, running @command{awk} programs and
address@hidden @code{FS} variable, setting from command line
address@hidden @code{FS}, containing @code{^}
address@hidden @code{FS}, in multiline records
address@hidden @code{HUP} signal, for dynamic profiling
address@hidden @code{IGNORECASE} variable, array indices and
address@hidden @code{IGNORECASE} variable, array sorting functions and
address@hidden @code{IGNORECASE} variable, in example programs
address@hidden @code{IGNORECASE} variable, with @code{~} and @code{!~} operators
address@hidden @code{LC_MESSAGES} locale category, @code{bindtextdomain()}
function (@command{gawk})
address@hidden @code{NF} variable, decrementing
address@hidden @code{NR} variable, changing
address@hidden @code{OFMT} variable, POSIX @command{awk} and
address@hidden @code{PROCINFO} array, communications via ptys and
address@hidden @code{PROCINFO} array, group membership and
address@hidden @code{PROCINFO} array, testing the field splitting
address@hidden @code{PROCINFO} array, user and group ID numbers and
address@hidden @code{PROCINFO}, values of @code{sorted_in}
address@hidden @code{RLENGTH} variable, @code{match()} function and
address@hidden @code{RSTART} variable, @code{match()} function and
address@hidden @code{RS} variable, multiline records and
address@hidden @code{SIGHUP} signal, for dynamic profiling
address@hidden @code{SIGUSR1} signal, for dynamic profiling
address@hidden @code{SUBSEP} variable, multidimensional arrays and
address@hidden @code{TEXTDOMAIN} variable, @code{BEGIN} pattern and
address@hidden @code{TEXTDOMAIN} variable, portability and
address@hidden @code{USR1} signal, for dynamic profiling
address@hidden @code{[]} (square brackets), regexp operator
address@hidden @code{\} (backslash), @code{\"} escape sequence
address@hidden @code{\} (backslash), @code{\'} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\/} escape sequence
address@hidden @code{\} (backslash), @code{\<} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\>} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\B} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\S} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\W} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\`} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\a} escape sequence
address@hidden @code{\} (backslash), @code{\b} escape sequence
address@hidden @code{\} (backslash), @code{\f} escape sequence
address@hidden @code{\} (backslash), @code{\n} escape sequence
address@hidden @code{\} (backslash), @code{\r} escape sequence
address@hidden @code{\} (backslash), @code{\s} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\t} escape sequence
address@hidden @code{\} (backslash), @code{\v} escape sequence
address@hidden @code{\} (backslash), @code{\w} operator (@command{gawk})
address@hidden @code{\} (backslash), @code{\x} escape sequence
address@hidden @code{\} (backslash), @code{\y} operator (@command{gawk})
address@hidden @code{\} (backslash), @address@hidden escape sequence
address@hidden @code{\} (backslash), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden @code{\} (backslash), as field separator
address@hidden @code{\} (backslash), continuing lines and
address@hidden @code{\} (backslash), continuing lines and, comments and
address@hidden @code{\} (backslash), continuing lines and, in @command{csh}
address@hidden @code{\} (backslash), in bracket expressions
address@hidden @code{\} (backslash), in escape sequences
address@hidden @code{\} (backslash), in escape sequences, POSIX and
address@hidden @code{\} (backslash), in regexp constants
address@hidden @code{\} (backslash), in shell commands
address@hidden @code{\} (backslash), regexp operator
address@hidden @code{^} (caret), @code{^=} operator
address@hidden @code{^} (caret), @code{^} operator
address@hidden @code{^} (caret), in @code{FS}
address@hidden @code{^} (caret), in bracket expressions
address@hidden @code{^} (caret), regexp operator
address@hidden @code{_} (underscore), C macro
address@hidden @code{_} (underscore), in names of private variables
address@hidden @code{_} (underscore), translatable string
address@hidden @code{asort()} function (@command{gawk}), address@hidden sorting
address@hidden @code{asorti()} function (@command{gawk}), address@hidden sorting
address@hidden @code{awk} namespace, identifier name storage
address@hidden @code{awk} namespace, use for indirect function calls
address@hidden @code{bindtextdomain()} function (@command{gawk}), portability
and
address@hidden @code{close()} function, portability
address@hidden @code{close()} function, return value
address@hidden @code{close()} function, two-way pipes and
address@hidden @code{date} utility, POSIX
address@hidden @code{dcgettext()} function (@command{gawk}), portability and
address@hidden @code{dcngettext()} function (@command{gawk}), portability and
address@hidden @address@hidden statement, use of regexps in
address@hidden @code{for} statement, looping over arrays
address@hidden @code{gensub()} function (@command{gawk}), escape processing
address@hidden @code{getgruser()} function, user-defined
address@hidden @code{getline} command, @code{FILENAME} variable and
address@hidden @code{getline} command, @code{_gr_init()} user-defined function
address@hidden @code{getline} command, @code{_pw_init()} function
address@hidden @code{getline} command, address@hidden using from
address@hidden @code{getline} command, deadlock and
address@hidden @code{getline} command, explicit input with
address@hidden @code{getline} command, return values
address@hidden @code{getline} command, variants
address@hidden @code{getline} statement, @code{BEGINFILE}/@code{ENDFILE}
patterns and
address@hidden @code{gsub()} function, arguments of
address@hidden @code{gsub()} function, escape processing
address@hidden @code{if} statement, address@hidden changing
address@hidden @code{if} statement, use of regexps in
address@hidden @code{in} operator, index existence in multidimensional arrays
address@hidden @code{in} operator, order of array access
address@hidden @code{in} operator, testing if array element exists
address@hidden @code{in} operator, use in loops
address@hidden @code{match()} function, @code{RSTART}/@code{RLENGTH} variables
address@hidden @code{nextfile} statement, @code{BEGINFILE}/@code{ENDFILE}
patterns and
address@hidden @code{nextfile} statement, @code{BEGIN}/@code{END} patterns and
address@hidden @code{nextfile} statement, user-defined functions and
address@hidden @code{next} statement, @code{BEGINFILE}/@code{ENDFILE} patterns
and
address@hidden @code{next} statement, @code{BEGIN}/@code{END} patterns and
address@hidden @code{next} statement, user-defined functions and
address@hidden @code{pawk}, @command{awk}-like facilities for Python
address@hidden @code{printf} statement, @code{sprintf()} function and
address@hidden @code{printf} statement, I/O operators in
address@hidden @code{printf} statement, address@hidden aligning
address@hidden @code{printf} statement, format-control characters
address@hidden @code{printf} statement, modifiers
address@hidden @code{printf} statement, positional specifiers
address@hidden @code{printf} statement, positional specifiers, mixing with
regular formats
address@hidden @code{printf} statement, syntax of
address@hidden @code{print} statement, @code{BEGIN}/@code{END} patterns and
address@hidden @code{print} statement, @code{OFMT} variable and
address@hidden @code{print} statement, @code{sprintf()} function and
address@hidden @code{print} statement, I/O operators in
address@hidden @code{print} statement, commas, omitting
address@hidden @code{print} statement, line continuations and
address@hidden @code{split()} function, array address@hidden deleting
address@hidden @code{sprintf()} function, @code{print}/@code{printf} statements
and
address@hidden @code{strtonum()} function (@command{gawk}),
@code{--non-decimal-data} option and
address@hidden @code{sub()} function, arguments of
address@hidden @code{sub()} function, escape processing
address@hidden @code{while} statement, use of regexps in
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O)
address@hidden @code{|} (vertical bar), @code{|&} operator (I/O),
address@hidden closing
address@hidden @code{|} (vertical bar), @code{||} operator
address@hidden @code{|} (vertical bar), @code{|} operator (I/O)
address@hidden @code{~} (tilde), @code{~} operator
address@hidden @command{awk} debugging, enabling
address@hidden @command{awk} language, POSIX version
address@hidden @command{awk} profiling, enabling
address@hidden @command{awk} programs, complex
address@hidden @command{awk} programs, documenting
address@hidden @command{awk} programs, examples of
address@hidden @command{awk} programs, execution of
address@hidden @command{awk} programs, internationalizing
address@hidden @command{awk} programs, lengthy
address@hidden @command{awk} programs, lengthy, assertions
address@hidden @command{awk} programs, location of
address@hidden @command{awk} programs, one-line examples
address@hidden @command{awk} programs, profiling
address@hidden @command{awk} programs, running
address@hidden @command{awk} programs, running, from shell scripts
address@hidden @command{awk} programs, running, without input files
address@hidden @command{awk} programs, shell variables in
address@hidden @command{awk}, @command{gawk} and
address@hidden @command{awk}, POSIX and
address@hidden @command{awk}, POSIX and @seealso{POSIX @command{awk}}
address@hidden @command{awk}, function of
address@hidden @command{awk}, history of
address@hidden @command{awk}, implementation issues, pipes
address@hidden @command{awk}, implementations
address@hidden @command{awk}, implementations, limits
address@hidden @command{awk}, invoking
address@hidden @command{awk}, new vs.@: old
address@hidden @command{awk}, new vs.@: old, @code{OFMT} variable
address@hidden @command{awk}, regexp constants and
address@hidden @command{awk}, terms describing
address@hidden @command{awk}, uses for
address@hidden @command{awk}, versions of
address@hidden @command{awk}, versions of @seealso{Brian Kernighan's
@command{awk}}
address@hidden @command{awk}, versions of, changes between SVR3.1 and SVR4
address@hidden @command{awk}, versions of, changes between SVR4 and POSIX
@command{awk}
address@hidden @command{awk}, versions of, changes between V7 and SVR3.1
address@hidden @command{csh} utility, @code{|&} operator, comparison with
address@hidden @command{csh} utility, @env{POSIXLY_CORRECT} environment variable
address@hidden @command{date} utility, GNU
address@hidden @command{gawk} program, dynamic profiling
address@hidden @command{gawk}, @code{ARGIND} variable in
address@hidden @command{gawk}, @code{ERRNO} variable in
address@hidden @command{gawk}, @code{FIELDWIDTHS} variable in
address@hidden @command{gawk}, @code{FPAT} variable in
address@hidden @command{gawk}, @code{FUNCTAB} array in
address@hidden @command{gawk}, @code{IGNORECASE} variable in
address@hidden @command{gawk}, @code{LINT} variable in
address@hidden @command{gawk}, @code{PROCINFO} array in
address@hidden @command{gawk}, @code{RT} variable in
address@hidden @command{gawk}, @code{SYMTAB} array in
address@hidden @command{gawk}, @code{TEXTDOMAIN} variable in
address@hidden @command{gawk}, @code{break} statement in
address@hidden @command{gawk}, @code{continue} statement in
address@hidden @command{gawk}, @command{awk} and
address@hidden @command{gawk}, MS-Windows version of
address@hidden @command{gawk}, VMS version of
address@hidden @command{gawk}, bitwise operations in
address@hidden @command{gawk}, character classes and
address@hidden @command{gawk}, coding style in
address@hidden @command{gawk}, command-line options, and regular expressions
address@hidden @command{gawk}, configuring
address@hidden @command{gawk}, configuring, options
address@hidden @command{gawk}, distribution
address@hidden @command{gawk}, escape sequences
address@hidden @command{gawk}, address@hidden disabling
address@hidden @command{gawk}, features, adding
address@hidden @command{gawk}, features, advanced
address@hidden @command{gawk}, field separators and
address@hidden @command{gawk}, file names in
address@hidden @command{gawk}, format-control characters
address@hidden @command{gawk}, function arguments and
address@hidden @command{gawk}, hexadecimal numbers and
address@hidden @command{gawk}, implementation issues
address@hidden @command{gawk}, implementation issues, debugging
address@hidden @command{gawk}, implementation issues, downward compatibility
address@hidden @command{gawk}, implementation issues, limits
address@hidden @command{gawk}, implementation issues, pipes
address@hidden @command{gawk}, installing
address@hidden @command{gawk}, internationalization and
@seeentry{internationalization}
address@hidden @command{gawk}, address@hidden adding code to
address@hidden @command{gawk}, interval expressions and
address@hidden @command{gawk}, line continuation in
address@hidden @command{gawk}, list of contributors to
address@hidden @command{gawk}, newlines in
address@hidden @command{gawk}, octal numbers and
address@hidden @command{gawk}, predefined variables and
address@hidden @command{gawk}, regexp constants and
address@hidden @command{gawk}, regular expressions, case sensitivity
address@hidden @command{gawk}, regular expressions, operators
address@hidden @command{gawk}, regular expressions, precedence
address@hidden @command{gawk}, source address@hidden obtaining
address@hidden @command{gawk}, splitting fields and
address@hidden @command{gawk}, string-translation functions
address@hidden @command{gawk}, timestamps
address@hidden @command{gawk}, uses for
address@hidden @command{gawk}, versions of, information address@hidden printing
address@hidden @command{gawk}, word-boundary operator
address@hidden @command{gettext} library, locale categories
address@hidden @command{sort} utility, coprocesses and
address@hidden @option{--dump-variables} option, using for library functions
address@hidden @option{--non-decimal-data} option, @code{strtonum()} function
and
address@hidden @option{--posix} option, @code{--traditional} option and
address@hidden @option{--sandbox} option, disabling @code{system()} function
address@hidden @option{--sandbox} option, input redirection with @code{getline}
address@hidden @option{--sandbox} option, output redirection with @code{print},
@code{printf}
address@hidden @option{--traditional} option, @code{--posix} option and
address@hidden @option{-F} option, @option{-Ft} sets @code{FS} to TAB
address@hidden @option{-F} option, command-line
address@hidden @option{-f} option, multiple uses
address@hidden Aho, Alfred
address@hidden Beebe, Nelson H.F.@:
address@hidden Bentley, Jon
address@hidden Benzinger, Michael
address@hidden Berry, Karl
address@hidden Boolean expressions, as patterns
address@hidden Bourne shell, quoting rules for
address@hidden Brennan, Michael
address@hidden Brian Kernighan's @command{awk}, extensions
address@hidden Brian Kernighan's @command{awk}, source code
address@hidden Brini, Davide
address@hidden Brink, Jeroen
address@hidden Broder, Alan J.@:
address@hidden Brown, Martin
address@hidden Buening, Andreas
address@hidden CGI, @command{awk} scripts for
address@hidden Chassell, Robert J.@:
address@hidden Close, Diane
address@hidden Collado, Manuel
address@hidden Colombo, Antonio
address@hidden Curreli, Marco
address@hidden Davies, Stephen
address@hidden Day, Robert P.J.@:
address@hidden Deifik, Scott
address@hidden Demaille, Akim
address@hidden Drepper, Ulrich
address@hidden Duman, Patrice
address@hidden English, Steve
address@hidden Fenlason, Jay
address@hidden Fish, Fred
address@hidden G., Daniel Richard
address@hidden GNU long options, printing list of
address@hidden GPL (General Public License), printing
address@hidden Garfinkle, Scott
address@hidden Git, use of for @command{gawk} source code
address@hidden Gordon, Assaf
address@hidden Grigera, Juan
address@hidden Guerrero, Juan Manuel
address@hidden Hankerson, Darrel
address@hidden Haque, John
address@hidden Hartholz, Elaine
address@hidden Hartholz, Marshall
address@hidden Hasegawa, Isamu
address@hidden Hughes, Phil
address@hidden Illumos, POSIX-compliant @command{awk}
address@hidden Jacobs, Andrew
address@hidden Jaegermann, Michal
address@hidden Johansen, Chris
address@hidden Kahrs, J@"urgen
address@hidden Kasal, Stepan
address@hidden Kenobi, Obi-Wan
address@hidden Kernighan, Brian
address@hidden Kwok, Conrad
address@hidden Langston, Peter
address@hidden MPFR, checking availability of
address@hidden MPFR, checking for
address@hidden Malmberg, John
address@hidden Marx, Groucho
address@hidden McIlroy, Doug
address@hidden McPhee, Patrick
address@hidden Moore, Duncan
address@hidden Oram, Andy
address@hidden PC operating systems, @command{gawk} on
address@hidden PC operating systems, @command{gawk} on, installing
address@hidden POSIX @command{awk}, @code{**=} operator and
address@hidden POSIX @command{awk}, @code{**} operator and
address@hidden POSIX @command{awk}, @code{<} operator and
address@hidden POSIX @command{awk}, @code{BEGIN}/@code{END} patterns
address@hidden POSIX @command{awk}, @code{CONVFMT} variable and
address@hidden POSIX @command{awk}, @code{OFMT} variable and
address@hidden POSIX @command{awk}, @code{break} statement and
address@hidden POSIX @command{awk}, @code{continue} statement and
address@hidden POSIX @command{awk}, @code{date} utility and
address@hidden POSIX @command{awk}, @code{function} keyword in
address@hidden POSIX @command{awk}, @code{next}/@code{nextfile} statements and
address@hidden POSIX @command{awk}, @code{printf} format strings and
address@hidden POSIX @command{awk}, @code{|} I/O operator and
address@hidden POSIX @command{awk}, GNU long options and
address@hidden POSIX @command{awk}, arithmetic operators and
address@hidden POSIX @command{awk}, backslashes in string constants
address@hidden POSIX @command{awk}, bracket expressions and
address@hidden POSIX @command{awk}, bracket expressions and, character classes
address@hidden POSIX @command{awk}, changes in @command{awk} versions
address@hidden POSIX @command{awk}, field separators and
address@hidden POSIX @command{awk}, functions and, @code{gsub()}/@code{sub()}
address@hidden POSIX @command{awk}, functions and, @code{length()}
address@hidden POSIX @command{awk}, interval expressions in
address@hidden POSIX @command{awk}, numeric strings and
address@hidden POSIX @command{awk}, period (@code{.})@comma{} using
address@hidden POSIX @command{awk}, regular expressions and
address@hidden POSIX @command{awk}, timestamps and
address@hidden POSIX, @command{awk} and
address@hidden POSIX, @command{gawk} extensions not included in
address@hidden POSIX, address@hidden implementing in @command{awk}
address@hidden Papadopoulos, Panos
address@hidden Peters, Arno
address@hidden Peterson, Hal
address@hidden Pitts, Dave
address@hidden Plauger, P.J.@:
address@hidden Quanstrom, Erik
address@hidden Rakitzis, Byron
address@hidden Ramey, Chet
address@hidden Rankin, Pat
address@hidden Ritchie, Dennis
address@hidden Robbins, Arnold
address@hidden Robbins, Bill
address@hidden Robbins, Harry
address@hidden Robbins, Jean
address@hidden Robbins, Miriam
address@hidden Rommel, Kai Uwe
address@hidden Rubin, Paul
address@hidden Schorr, Andrew
address@hidden Schreiber, Bert
address@hidden Schreiber, Rita
address@hidden Skywalker, Luke
address@hidden Solaris, POSIX-compliant @command{awk}
address@hidden Spencer, Henry
address@hidden Stallman, Richard
address@hidden Sumner, Andrew
address@hidden TCP/IP, support for
address@hidden Texinfo, chapter beginnings in files
address@hidden Texinfo, extracting programs from source files
address@hidden Trueman, David
address@hidden Unix @command{awk}, @code{close()} function and
address@hidden Unix @command{awk}, backslashes in escape sequences
address@hidden Unix @command{awk}, password address@hidden field separators and
address@hidden Unix, @command{awk} scripts and
address@hidden Vinschen, Corinna
address@hidden Wall, Larry
address@hidden Wallin, Anders
address@hidden Weinberger, Peter
address@hidden Williams, Kent
address@hidden Woehlke, Matthew
address@hidden Woods, John
address@hidden Yawitz, Efraim
address@hidden Zaretskii, Eli
address@hidden Zoulas, Christos
address@hidden actions, control statements in
address@hidden actions, default
address@hidden actions, empty
address@hidden adding, features to @command{gawk}
address@hidden adding, fields
address@hidden advanced features, @command{gawk}
address@hidden advanced features, fixed-width data
address@hidden advanced features, network programming
address@hidden advanced features, nondecimal input data
address@hidden advanced features, address@hidden communicating with
address@hidden advanced features, specifying field content
address@hidden ambiguity, syntactic: @code{/=} operator vs.
@code{/address@hidden/} regexp constant
address@hidden ampersand (@code{&}), @code{&&} operator
address@hidden ampersand (@code{&}), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden anagrams, finding
address@hidden arguments, command-line
address@hidden arguments, command-line, invoking @command{awk}
address@hidden arguments, in function calls
address@hidden arguments, processing
address@hidden array scanning order, controlling
address@hidden array subscripts, null strings as
address@hidden array subscripts, numbers as
address@hidden array, number of elements
address@hidden arrays, @code{IGNORECASE} variable and
address@hidden arrays, @code{for} statement and
address@hidden arrays, an example of using
address@hidden arrays, as parameters to functions
address@hidden arrays, associative
address@hidden arrays, associative, library functions and
address@hidden arrays, deleting entire contents
address@hidden arrays, elements that don't exist
address@hidden arrays, elements, assigning values
address@hidden arrays, elements, deleting
address@hidden arrays, elements, order of access by @code{in} operator
address@hidden arrays, elements, retrieving number of
address@hidden arrays, indexing
address@hidden arrays, merging into strings
address@hidden arrays, multidimensional
address@hidden arrays, multidimensional, scanning
address@hidden arrays, numeric subscripts
address@hidden arrays, referencing elements
address@hidden arrays, scanning
address@hidden arrays, sorting
address@hidden arrays, sorting, @code{IGNORECASE} variable and
address@hidden arrays, sparse
address@hidden arrays, subscripts, uninitialized variables as
address@hidden arrays, unassigned elements
address@hidden assign values to variables, in debugger
address@hidden assignment operators, evaluation order
address@hidden assignment operators, lvalues/rvalues
address@hidden asterisk (@code{*}), @code{**=} operator
address@hidden asterisk (@code{*}), @code{**} operator
address@hidden asterisk (@code{*}), @code{*=} operator
address@hidden asterisk (@code{*}), @code{*} operator, as multiplication
operator
address@hidden asterisk (@code{*}), @code{*} operator, as regexp operator
address@hidden asterisk (@code{*}), @code{*} operator, null address@hidden
matching
address@hidden automatic displays, in debugger
address@hidden backslash (@code{\}), @code{\"} escape sequence
address@hidden backslash (@code{\}), @code{\'} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\/} escape sequence
address@hidden backslash (@code{\}), @code{\<} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\>} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\B} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\S} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\W} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\`} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\a} escape sequence
address@hidden backslash (@code{\}), @code{\b} escape sequence
address@hidden backslash (@code{\}), @code{\f} escape sequence
address@hidden backslash (@code{\}), @code{\n} escape sequence
address@hidden backslash (@code{\}), @code{\r} escape sequence
address@hidden backslash (@code{\}), @code{\s} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\t} escape sequence
address@hidden backslash (@code{\}), @code{\v} escape sequence
address@hidden backslash (@code{\}), @code{\w} operator (@command{gawk})
address@hidden backslash (@code{\}), @code{\x} escape sequence
address@hidden backslash (@code{\}), @code{\y} operator (@command{gawk})
address@hidden backslash (@code{\}), @address@hidden escape sequence
address@hidden backslash (@code{\}), @code{gsub()}/@code{gensub()}/@code{sub()}
functions and
address@hidden backslash (@code{\}), as field separator
address@hidden backslash (@code{\}), continuing lines and
address@hidden backslash (@code{\}), continuing lines and, comments and
address@hidden backslash (@code{\}), continuing lines and, in @command{csh}
address@hidden backslash (@code{\}), in bracket expressions
address@hidden backslash (@code{\}), in escape sequences
address@hidden backslash (@code{\}), in escape sequences, POSIX and
address@hidden backslash (@code{\}), in regexp constants
address@hidden backslash (@code{\}), in shell commands
address@hidden backslash (@code{\}), regexp operator
address@hidden bitwise, operations
address@hidden bitwise, shift
address@hidden body, in actions
address@hidden body, in loops
address@hidden braces (@address@hidden@}}), actions and
address@hidden braces (@address@hidden@}}), statements, grouping
address@hidden bracket expressions, character classes
address@hidden bracket expressions, collating elements
address@hidden bracket expressions, collating symbols
address@hidden bracket expressions, complemented
address@hidden bracket expressions, equivalence classes
address@hidden bracket expressions, non-ASCII
address@hidden bracket expressions, range expressions
address@hidden breakpoint at location, how to delete
address@hidden breakpoint, delete by number
address@hidden breakpoint, how to disable or enable
address@hidden breakpoint, setting
address@hidden buffering, input/output
address@hidden buffering, interactive vs.@: noninteractive
address@hidden buffers, flushing
address@hidden buffers, operators for
address@hidden bug reports, email address, @code{bug-gawk@@gnu.org}
address@hidden built-in functions, evaluation order
address@hidden call stack, display in debugger
address@hidden caret (@code{^}), @code{^=} operator
address@hidden caret (@code{^}), @code{^} operator
address@hidden caret (@code{^}), in bracket expressions
address@hidden caret (@code{^}), regexp operator
address@hidden case sensitivity, @command{gawk}
address@hidden case sensitivity, array indices and
address@hidden case sensitivity, converting case
address@hidden case sensitivity, example programs
address@hidden case sensitivity, regexps and
address@hidden case sensitivity, string comparisons and
address@hidden characters, counting
address@hidden characters, transliterating
address@hidden characters, values of as numbers
address@hidden colon (@code{:}), @code{?:} operator
address@hidden columns, aligning
address@hidden columns, cutting
address@hidden comma (@code{,}), in range patterns
address@hidden command completion, in debugger
address@hidden command line, @code{FS} address@hidden setting
address@hidden command line, arguments
address@hidden command line, directories on
address@hidden command line, formats
address@hidden command line, invoking @command{awk} from
address@hidden command line, option @option{-f}
address@hidden command line, options
address@hidden command line, options, end of
address@hidden command line, address@hidden assigning on
address@hidden command-line options, processing
address@hidden command-line options, string extraction
address@hidden commenting, backslash continuation and
address@hidden common extensions, @code{**=} operator
address@hidden common extensions, @code{**} operator
address@hidden common extensions, @code{/dev/stderr} special file
address@hidden common extensions, @code{/dev/stdin} special file
address@hidden common extensions, @code{/dev/stdout} special file
address@hidden common extensions, @code{BINMODE} variable
address@hidden common extensions, @code{RS} as a regexp
address@hidden common extensions, @code{\x} escape sequence
address@hidden common extensions, @code{delete} to delete entire arrays
address@hidden common extensions, @code{func} keyword
address@hidden common extensions, @code{length()} applied to an array
address@hidden common extensions, single character fields
address@hidden comparison expressions, as patterns
address@hidden comparison expressions, string vs.@: regexp
address@hidden compatibility mode (@command{gawk}), extensions
address@hidden compatibility mode (@command{gawk}), file names
address@hidden compatibility mode (@command{gawk}), hexadecimal numbers
address@hidden compatibility mode (@command{gawk}), octal numbers
address@hidden compatibility mode (@command{gawk}), specifying
address@hidden complement, bitwise
address@hidden component names, naming rules
address@hidden configuration option, @code{--disable-extensions}
address@hidden configuration option, @code{--disable-lint}
address@hidden configuration option, @code{--disable-mpfr}
address@hidden configuration option, @code{--disable-nls}
address@hidden configuration option, @code{--enable-versioned-extension-dir}
address@hidden constants, nondecimal
address@hidden constants, numeric
address@hidden constants, types of
address@hidden continue program, in debugger
address@hidden converting, dates to timestamps
address@hidden converting, numbers to strings
address@hidden converting, strings to numbers
address@hidden coprocesses, @code{getline} from
address@hidden coprocesses, closing
address@hidden currency symbols, localization
address@hidden current namespace, pushing and popping
address@hidden dark corner, @code{"0"} is actually true
address@hidden dark corner, @code{/=} operator vs. @code{/address@hidden/}
regexp constant
address@hidden dark corner, @code{ARGV} variable, value of
address@hidden dark corner, @code{CONVFMT} variable
address@hidden dark corner, @code{FILENAME} variable
address@hidden dark corner, @code{FNR}/@code{NR} variables
address@hidden dark corner, @code{FS} as null string
address@hidden dark corner, @code{NF} variable, decrementing
address@hidden dark corner, @code{OFMT} variable
address@hidden dark corner, @code{^}, in @code{FS}
address@hidden dark corner, @code{break} statement
address@hidden dark corner, @code{close()} function
address@hidden dark corner, @code{continue} statement
address@hidden dark corner, @code{exit} statement
address@hidden dark corner, @code{length()} function
address@hidden dark corner, @code{split()} function
address@hidden dark corner, array subscripts
address@hidden dark corner, command-line arguments
address@hidden dark corner, empty programs
address@hidden dark corner, escape sequences
address@hidden dark corner, escape sequences, for metacharacters
address@hidden dark corner, field separators
address@hidden dark corner, format-control characters
address@hidden dark corner, input files
address@hidden dark corner, invoking @command{awk}
address@hidden dark corner, locale's decimal point character
address@hidden dark corner, multiline records
address@hidden dark corner, range patterns, line continuation and
address@hidden dark corner, regexp as second argument to @code{index()}
address@hidden dark corner, regexp constants
address@hidden dark corner, regexp constants, @code{/=} operator and
address@hidden dark corner, regexp constants, as arguments to user-defined
functions
address@hidden dark corner, string continuation
address@hidden dark corner, strings, storing
address@hidden dark corner, value of @code{ARGV[0]}
address@hidden data, fixed-width
address@hidden database, address@hidden reading
address@hidden database, address@hidden reading
address@hidden dates, converting to timestamps
address@hidden dates, information related address@hidden localization
address@hidden debugger commands, @code{backtrace}
address@hidden debugger commands, @code{break}
address@hidden debugger commands, @code{bt} (@code{backtrace})
address@hidden debugger commands, @code{b} (@code{break})
address@hidden debugger commands, @code{clear}
address@hidden debugger commands, @code{commands}
address@hidden debugger commands, @code{condition}
address@hidden debugger commands, @code{continue}
address@hidden debugger commands, @code{c} (@code{continue})
address@hidden debugger commands, @code{delete}
address@hidden debugger commands, @code{disable}
address@hidden debugger commands, @code{display}
address@hidden debugger commands, @code{down}
address@hidden debugger commands, @code{dump}
address@hidden debugger commands, @code{d} (@code{delete})
address@hidden debugger commands, @code{enable}
address@hidden debugger commands, @code{end}
address@hidden debugger commands, @code{eval}
address@hidden debugger commands, @code{e} (@code{enable})
address@hidden debugger commands, @code{finish}
address@hidden debugger commands, @code{frame}
address@hidden debugger commands, @code{f} (@code{frame})
address@hidden debugger commands, @code{help}
address@hidden debugger commands, @code{h} (@code{help})
address@hidden debugger commands, @code{ignore}
address@hidden debugger commands, @code{info}
address@hidden debugger commands, @code{i} (@code{info})
address@hidden debugger commands, @code{list}
address@hidden debugger commands, @code{l} (@code{list})
address@hidden debugger commands, @code{nexti}
address@hidden debugger commands, @code{next}
address@hidden debugger commands, @code{ni} (@code{nexti})
address@hidden debugger commands, @code{n} (@code{next})
address@hidden debugger commands, @code{option}
address@hidden debugger commands, @code{o} (@code{option})
address@hidden debugger commands, @code{printf}
address@hidden debugger commands, @code{print}
address@hidden debugger commands, @code{p} (@code{print})
address@hidden debugger commands, @code{quit}
address@hidden debugger commands, @code{q} (@code{quit})
address@hidden debugger commands, @code{return}
address@hidden debugger commands, @code{run}
address@hidden debugger commands, @code{r} (@code{run})
address@hidden debugger commands, @code{set}
address@hidden debugger commands, @code{silent}
address@hidden debugger commands, @code{si} (@code{stepi})
address@hidden debugger commands, @code{stepi}
address@hidden debugger commands, @code{step}
address@hidden debugger commands, @code{s} (@code{step})
address@hidden debugger commands, @code{tbreak}
address@hidden debugger commands, @code{trace}
address@hidden debugger commands, @code{t} (@code{tbreak})
address@hidden debugger commands, @code{undisplay}
address@hidden debugger commands, @code{until}
address@hidden debugger commands, @code{unwatch}
address@hidden debugger commands, @code{up}
address@hidden debugger commands, @code{u} (@code{until})
address@hidden debugger commands, @code{watch}
address@hidden debugger commands, @code{where} (@code{backtrace})
address@hidden debugger commands, @code{w} (@code{watch})
address@hidden debugger, @code{backtrace} command
address@hidden debugger, @code{breakpoint} command
address@hidden debugger, @code{break} command
address@hidden debugger, @code{bt} command
address@hidden debugger, @code{b} command
address@hidden debugger, @code{next} command
address@hidden debugger, @code{n} command
address@hidden debugger, @code{print} command
address@hidden debugger, @code{p} command
address@hidden debugger, @code{run} command
address@hidden debugger, command completion
address@hidden debugger, concepts
address@hidden debugger, default list amount
address@hidden debugger, history expansion
address@hidden debugger, history file
address@hidden debugger, history size
address@hidden debugger, how to start
address@hidden debugger, instruction tracing
address@hidden debugger, interaction with namespaces
address@hidden debugger, limitations
address@hidden debugger, options
address@hidden debugger, printing all array elements
address@hidden debugger, printing single array elements
address@hidden debugger, prompt
address@hidden debugger, read commands from a file
address@hidden debugger, repeating commands
address@hidden debugger, running the program
address@hidden debugger, save commands to a file
address@hidden debugger, setting a breakpoint
address@hidden debugger, stack frames, showing
address@hidden debugging @command{gawk}, bug reports
address@hidden debugging, example session
address@hidden decimal point character, locale specific
address@hidden delete breakpoint, at location
address@hidden delete breakpoint, by number
address@hidden describe call stack frame, in debugger
address@hidden differences in @command{awk} and @command{gawk},
@code{ARGC}/@code{ARGV} variables
address@hidden differences in @command{awk} and @command{gawk}, @code{ARGIND}
variable
address@hidden differences in @command{awk} and @command{gawk},
@code{AWKLIBPATH} environment variable
address@hidden differences in @command{awk} and @command{gawk},
@code{BEGINFILE}/@code{ENDFILE} patterns
address@hidden differences in @command{awk} and @command{gawk},
@code{BEGIN}/@code{END} patterns
address@hidden differences in @command{awk} and @command{gawk}, @code{BINMODE}
variable
address@hidden differences in @command{awk} and @command{gawk}, @code{ERRNO}
variable
address@hidden differences in @command{awk} and @command{gawk},
@code{FIELDWIDTHS} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{FPAT}
variable
address@hidden differences in @command{awk} and @command{gawk}, @code{FUNCTAB}
variable
address@hidden differences in @command{awk} and @command{gawk},
@code{IGNORECASE} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{LINT}
variable
address@hidden differences in @command{awk} and @command{gawk}, @code{PROCINFO}
array
address@hidden differences in @command{awk} and @command{gawk},
@code{RS}/@code{RT} variables
address@hidden differences in @command{awk} and @command{gawk}, @code{SYMTAB}
variable
address@hidden differences in @command{awk} and @command{gawk},
@code{TEXTDOMAIN} variable
address@hidden differences in @command{awk} and @command{gawk}, @code{close()}
function
address@hidden differences in @command{awk} and @command{gawk}, @code{getline}
command
address@hidden differences in @command{awk} and @command{gawk}, @code{length()}
function
address@hidden differences in @command{awk} and @command{gawk}, @code{match()}
function
address@hidden differences in @command{awk} and @command{gawk},
@code{print}/@code{printf} statements
address@hidden differences in @command{awk} and @command{gawk}, @code{split()}
function
address@hidden differences in @command{awk} and @command{gawk}, @env{AWKPATH}
environment variable
address@hidden differences in @command{awk} and @command{gawk}, array elements,
deleting
address@hidden differences in @command{awk} and @command{gawk}, command-line
directories
address@hidden differences in @command{awk} and @command{gawk}, error messages
address@hidden differences in @command{awk} and @command{gawk}, function
arguments (@command{gawk})
address@hidden differences in @command{awk} and @command{gawk}, implementation
limitations
address@hidden differences in @command{awk} and @command{gawk}, indirect
function calls
address@hidden differences in @command{awk} and @command{gawk}, input/output
operators
address@hidden differences in @command{awk} and @command{gawk}, line
continuations
address@hidden differences in @command{awk} and @command{gawk}, read timeouts
address@hidden differences in @command{awk} and @command{gawk}, record
separators
address@hidden differences in @command{awk} and @command{gawk}, regexp constants
address@hidden differences in @command{awk} and @command{gawk}, regular
expressions
address@hidden differences in @command{awk} and @command{gawk}, retrying input
address@hidden differences in @command{awk} and @command{gawk},
single-character fields
address@hidden differences in @command{awk} and @command{gawk}, strings
address@hidden differences in @command{awk} and @command{gawk}, strings, storing
address@hidden differences in @command{awk} and @command{gawk}, trunc-mod
operation
address@hidden directories, command-line
address@hidden directories, searching
address@hidden directories, searching for loadable extensions
address@hidden directories, searching for source files
address@hidden documentation, of @command{awk} programs
address@hidden documentation, online
address@hidden dollar sign (@code{$}), @code{$} field operator
address@hidden dollar sign (@code{$}), incrementing fields and arrays
address@hidden dollar sign (@code{$}), regexp operator
address@hidden double quote (@code{"}), in regexp constants
address@hidden double quote (@code{"}), in shell commands
address@hidden elements in arrays, assigning values
address@hidden elements in arrays, deleting
address@hidden elements in arrays, order of access by @code{in} operator
address@hidden elements in arrays, scanning
address@hidden email address for bug reports, @code{bug-gawk@@gnu.org}
address@hidden environment variables, in @code{ENVIRON} array
address@hidden epoch, definition of
address@hidden equals sign (@code{=}), @code{==} operator
address@hidden equals sign (@code{=}), @code{=} operator
address@hidden error handling, @code{ERRNO} variable and
address@hidden escape processing, @code{gsub()}/@code{gensub()}/@code{sub()}
functions
address@hidden escape sequences, in strings
address@hidden evaluate expressions, in debugger
address@hidden evaluation order, concatenation
address@hidden evaluation order, functions
address@hidden exclamation point (@code{!}), @code{!=} operator
address@hidden exclamation point (@code{!}), @code{!} operator
address@hidden exclamation point (@code{!}), @code{!~} operator
address@hidden exit status, of @command{gawk}
address@hidden exit status, of @command{gawk}, on VMS
address@hidden expressions, Boolean
address@hidden expressions, as patterns
address@hidden expressions, assignment
address@hidden expressions, comparison
address@hidden expressions, conditional
address@hidden expressions, matching @seeentry{comparison expressions}
address@hidden expressions, selecting
address@hidden extension API, version number
address@hidden extensions, @command{mawk}
address@hidden extensions, Brian Kernighan's @command{awk}
address@hidden extensions, allocating memory
address@hidden extensions, array manipulation in
address@hidden extensions, address@hidden @code{**=} operator
address@hidden extensions, address@hidden @code{**} operator
address@hidden extensions, address@hidden @code{/dev/stderr} special file
address@hidden extensions, address@hidden @code{/dev/stdin} special file
address@hidden extensions, address@hidden @code{/dev/stdout} special file
address@hidden extensions, address@hidden @code{BINMODE} variable
address@hidden extensions, address@hidden @code{RS} as a regexp
address@hidden extensions, address@hidden @code{\x} escape sequence
address@hidden extensions, address@hidden @code{delete} to delete entire arrays
address@hidden extensions, address@hidden @code{fflush()} function
address@hidden extensions, address@hidden @code{func} keyword
address@hidden extensions, address@hidden @code{length()} applied to an array
address@hidden extensions, address@hidden single character fields
address@hidden extensions, in @command{gawk}, not in POSIX @command{awk}
address@hidden extensions, loading, @code{@@load} directive
address@hidden extensions, where to find
address@hidden extraction, of marked strings (internationalization)
address@hidden false, logical
address@hidden features, adding to @command{gawk}
address@hidden features, deprecated
address@hidden features, undocumented
address@hidden field separator, POSIX and
address@hidden field separator, backslash (@code{\}) as
address@hidden field separator, in multiline records
address@hidden field separator, on command line
address@hidden field separators, @code{FIELDWIDTHS} variable and
address@hidden field separators, @code{FPAT} variable and
address@hidden field separators, choice of
address@hidden field separators, regular expressions as
address@hidden field separators, spaces as
address@hidden field separators, whitespace as
address@hidden fields, adding
address@hidden fields, changing contents of
address@hidden fields, cutting
address@hidden fields, examining
address@hidden fields, number of
address@hidden fields, numbers
address@hidden fields, printing
address@hidden fields, separating
address@hidden fields, single-character
address@hidden file inclusion, @code{@@include} directive
address@hidden file names, assignments as
address@hidden file names, distinguishing
address@hidden file names, in compatibility mode
address@hidden file names, standard streams in @command{gawk}
address@hidden files, @code{.gmo}
address@hidden files, @code{.gmo}, specifying directory of
address@hidden files, @code{.mo}, converting from @code{.po}
address@hidden files, @code{.pot}
address@hidden files, @code{.po}
address@hidden files, @code{.po}, converting to @code{.mo}
address@hidden files, @code{/dev/@dots{}} special files
address@hidden files, @code{/inet/@dots{}} (@command{gawk})
address@hidden files, @code{/inet4/@dots{}} (@command{gawk})
address@hidden files, @code{/inet6/@dots{}} (@command{gawk})
address@hidden files, @code{awkprof.out}
address@hidden files, @command{awk} programs in
address@hidden files, @file{awkvars.out}
address@hidden files, address@hidden extracting programs from
address@hidden files, closing
address@hidden files, descriptors @seeentry{file descriptors}
address@hidden files, group
address@hidden files, initialization and cleanup
address@hidden files, input @seeentry{input files}
address@hidden files, address@hidden timestamps in
address@hidden files, managing
address@hidden files, managing, data file boundaries
address@hidden files, message object
address@hidden files, message object, converting from portable object files
address@hidden files, message object, specifying directory of
address@hidden files, multiple passes over
address@hidden files, address@hidden duplicating output into
address@hidden files, output @seeentry{output files}
address@hidden files, password
address@hidden files, portable object
address@hidden files, portable object template
address@hidden files, portable object, converting to message object files
address@hidden files, portable object, generating
address@hidden files, address@hidden @code{ARGIND} variable and
address@hidden files, reading
address@hidden files, reading, multiline records
address@hidden files, searching for regular expressions
address@hidden files, skipping
address@hidden files, address@hidden search path for
address@hidden files, splitting
address@hidden floating-point, VAX/VMS
address@hidden floating-point, numbers
address@hidden floating-point, address@hidden arbitrary-precision
address@hidden floating-point, address@hidden double-precision
address@hidden floating-point, address@hidden single-precision
address@hidden format specifiers, @code{printf} statement
address@hidden format specifiers, @code{strftime()} function (@command{gawk})
address@hidden format specifiers, mixing regular with positional specifiers
address@hidden forward slash (@code{/}), @code{/=} operator
address@hidden forward slash (@code{/}), @code{/=} operator, vs.
@code{/address@hidden/} regexp constant
address@hidden forward slash (@code{/}), @code{/} operator
address@hidden forward slash (@code{/}), patterns and
address@hidden function calls, indirect
address@hidden function calls, indirect, @code{@@}-notation for
address@hidden functions, arrays as parameters to
address@hidden functions, built-in
address@hidden functions, built-in, evaluation order
address@hidden functions, defining
address@hidden functions, library
address@hidden functions, library, C library
address@hidden functions, library, Cliff random numbers
address@hidden functions, library, assertions
address@hidden functions, library, associative arrays and
address@hidden functions, library, character values as numbers
address@hidden functions, library, command-line options
address@hidden functions, library, example program for using
address@hidden functions, library, group address@hidden reading
address@hidden functions, library, managing data files
address@hidden functions, library, managing time
address@hidden functions, library, merging arrays into strings
address@hidden functions, library, rounding numbers
address@hidden functions, library, user address@hidden reading
address@hidden functions, names of
address@hidden functions, recursive
address@hidden functions, string-translation
address@hidden functions, undefined
address@hidden functions, user-defined
address@hidden functions, user-defined, @code{next}/@code{nextfile} statements
and
address@hidden functions, user-defined, calling
address@hidden functions, user-defined, address@hidden in a profile
address@hidden functions, user-defined, library of
address@hidden group database, reading
address@hidden history expansion, in debugger
address@hidden hyphen (@code{-}), @code{--} operator
address@hidden hyphen (@code{-}), @code{-=} operator
address@hidden hyphen (@code{-}), @code{-} operator
address@hidden hyphen (@code{-}), file names beginning with
address@hidden hyphen (@code{-}), in bracket expressions
address@hidden implementation issues, @command{gawk}
address@hidden implementation issues, @command{gawk}, debugging
address@hidden implementation issues, @command{gawk}, limits
address@hidden including files, @code{@@include} directive
address@hidden indirect function calls, @code{@@}-notation
address@hidden initialization, automatic
address@hidden input files, closing
address@hidden input files, counting elements in
address@hidden input files, examples
address@hidden input files, reading
address@hidden input files, running @command{awk} without
address@hidden input files, variable assignments and
address@hidden input record, length of
address@hidden input, address@hidden nondecimal
address@hidden input, explicit
address@hidden input, files @seeentry{input files}
address@hidden input, multiline records
address@hidden input, splitting into records
address@hidden input, standard
address@hidden input/output, binary
address@hidden input/output, from @code{BEGIN} and @code{END}
address@hidden input/output, two-way
address@hidden insomnia, cure for
address@hidden installation, VMS
address@hidden instruction tracing, in debugger
address@hidden integers, arbitrary precision
address@hidden integers, unsigned
address@hidden internationalization, localization
address@hidden internationalization, localization, @command{gawk} and
address@hidden internationalization, localization, character classes
address@hidden internationalization, localization, locale categories
address@hidden internationalization, localization, marked strings
address@hidden internationalization, localization, portability and
address@hidden interval expressions, regexp operator
address@hidden knights, jedi
address@hidden left angle bracket (@code{<}), @code{<=} operator
address@hidden left angle bracket (@code{<}), @code{<} operator
address@hidden left angle bracket (@code{<}), @code{<} operator (I/O)
address@hidden left shift, bitwise
address@hidden libraries of @command{awk} functions, assertions
address@hidden libraries of @command{awk} functions, associative arrays and
address@hidden libraries of @command{awk} functions, character values as numbers
address@hidden libraries of @command{awk} functions, command-line options
address@hidden libraries of @command{awk} functions, example program for using
address@hidden libraries of @command{awk} functions, group database, reading
address@hidden libraries of @command{awk} functions, managing, data files
address@hidden libraries of @command{awk} functions, managing, time
address@hidden libraries of @command{awk} functions, merging arrays into strings
address@hidden libraries of @command{awk} functions, rounding numbers
address@hidden libraries of @command{awk} functions, user database, reading
address@hidden line continuations, @command{gawk}
address@hidden line continuations, in @code{print} statement
address@hidden line continuations, with C shell
address@hidden lines, address@hidden printing
address@hidden lines, counting
address@hidden lines, address@hidden removing
address@hidden lines, matching ranges of
address@hidden lines, skipping between markers
address@hidden lint checking, @env{POSIXLY_CORRECT} environment variable
address@hidden lint checking, array elements
address@hidden lint checking, array subscripts
address@hidden lint checking, empty programs
address@hidden lint checking, issuing warnings
address@hidden lint checking, undefined functions
address@hidden list all global variables, in debugger
address@hidden list function definitions, in debugger
address@hidden loading extensions, @code{@@load} directive
address@hidden local variables, in a function
address@hidden locale, definition of
address@hidden log files, timestamps in
address@hidden loops, @code{break} statement and
address@hidden loops, @code{continue} statements and
address@hidden loops, @address@hidden
address@hidden loops, @code{for}, array scanning
address@hidden loops, @code{for}, iterative
address@hidden loops, @code{while}
address@hidden loops, count for address@hidden in a profile
address@hidden loops, exiting
address@hidden mailing list, GNITS
address@hidden matching, expressions @seeentry{comparison expressions}
address@hidden matching, leftmost longest
address@hidden matching, null strings
address@hidden memory, allocating for extensions
address@hidden message object files, converting from portable object files
address@hidden message object files, specifying directory of
address@hidden metacharacters, escape sequences for
address@hidden module, definition of
address@hidden monetary information, localization
address@hidden names, arrays/variables
address@hidden names, functions
address@hidden namespace issues, functions
address@hidden namespace names, naming rules
address@hidden namespace, @code{awk}
address@hidden namespace, default
address@hidden namespace, definition of
address@hidden namespace, example code
address@hidden namespace, implicit
address@hidden namespace, pushing and popping
address@hidden namespace, standard @command{awk}, global
address@hidden namespaces, backwards compatibility
address@hidden namespaces, changing
address@hidden namespaces, interaction with debugger
address@hidden namespaces, interaction with extension API
address@hidden namespaces, interaction with pretty printer
address@hidden namespaces, interaction with profiler
address@hidden namespaces, qualified names
address@hidden naming rules, namespaces and component names
address@hidden networks, programming
address@hidden networks, support for
address@hidden newlines, as record separators
address@hidden newlines, in dynamic regexps
address@hidden newlines, in regexp constants
address@hidden newlines, printing
address@hidden newlines, separating statements in actions
address@hidden null strings in @command{gawk} arguments, quoting and
address@hidden null strings, as array subscripts
address@hidden null strings, converting numbers to strings
address@hidden null strings, deleting array elements and
address@hidden null strings, matching
address@hidden number sign (@code{#}), @code{#!} (executable scripts)
address@hidden number sign (@code{#}), commenting
address@hidden numbers, Cliff random
address@hidden numbers, as array subscripts
address@hidden numbers, as string of bits
address@hidden numbers, as values of characters
address@hidden numbers, converting
address@hidden numbers, converting, to strings
address@hidden numbers, hexadecimal
address@hidden numbers, octal
address@hidden numbers, rounding
address@hidden numeric, output format
address@hidden numeric, strings
address@hidden operating systems, BSD-based
address@hidden operating systems, address@hidden @command{gawk} on
address@hidden operating systems, address@hidden @command{gawk} on, installing
address@hidden operating systems, porting @command{gawk} to
address@hidden operations, bitwise
address@hidden operators, Boolean @seeentry{Boolean expressions}
address@hidden operators, GNU-specific
address@hidden operators, arithmetic
address@hidden operators, assignment
address@hidden operators, assignment, evaluation order
address@hidden operators, decrement/increment
address@hidden operators, input/output
address@hidden operators, logical @seeentry{Boolean expressions}
address@hidden operators, precedence
address@hidden operators, precedence of
address@hidden operators, relational @address@hidden comparison}
address@hidden operators, short-circuit
address@hidden operators, string
address@hidden operators, string-matching
address@hidden operators, string-matching, for buffers
address@hidden operators, word-boundary (@command{gawk})
address@hidden options, command-line
address@hidden options, command-line, end of
address@hidden options, command-line, invoking @command{awk}
address@hidden options, command-line, processing
address@hidden options, deprecated
address@hidden options, long
address@hidden options, printing list of
address@hidden order of evaluation, concatenation
address@hidden output, buffering
address@hidden output, duplicating into files
address@hidden output, address@hidden closing
address@hidden output, format address@hidden @code{OFMT}
address@hidden output, formatted
address@hidden output, pipes
address@hidden output, printing @seeentry{printing}
address@hidden output, records
address@hidden output, standard
address@hidden package, definition of
address@hidden parentheses @code{()}, in a profile
address@hidden parentheses @code{()}, regexp operator
address@hidden patterns, Boolean expressions as
address@hidden patterns, comparison expressions as
address@hidden patterns, counts, in a profile
address@hidden patterns, default
address@hidden patterns, empty
address@hidden patterns, expressions as
address@hidden patterns, ranges in
address@hidden patterns, regexp constants as
address@hidden patterns, regular expressions as
address@hidden patterns, types of
address@hidden percent sign (@code{%}), @code{%=} operator
address@hidden percent sign (@code{%}), @code{%} operator
address@hidden period (@code{.}), regexp operator
address@hidden pipe, closing
address@hidden pipe, input
address@hidden pipe, output
address@hidden plus sign (@code{+}), @code{++} operator
address@hidden plus sign (@code{+}), @code{+=} operator
address@hidden plus sign (@code{+}), @code{+} operator
address@hidden plus sign (@code{+}), regexp operator
address@hidden portability, @code{#!} (executable scripts)
address@hidden portability, @code{**=} operator and
address@hidden portability, @code{**} operator and
address@hidden portability, @code{ARGV} variable
address@hidden portability, @code{NF} address@hidden decrementing
address@hidden portability, @code{close()} function and
address@hidden portability, @code{length()} function
address@hidden portability, @code{next} statement in user-defined functions
address@hidden portability, @code{substr()} function
address@hidden portability, @command{gawk}
address@hidden portability, @command{gettext} library and
address@hidden portability, @env{POSIXLY_CORRECT} environment variable
address@hidden portability, backslash continuation and
address@hidden portability, backslash in escape sequences
address@hidden portability, data files as single record
address@hidden portability, deleting array elements
address@hidden portability, example programs
address@hidden portability, address@hidden defining
address@hidden portability, internationalization and
address@hidden portability, new @command{awk} vs.@: old @command{awk}
address@hidden portability, operators
address@hidden portability, operators, not in POSIX @command{awk}
address@hidden portable object files, converting to message object files
address@hidden portable object files, generating
address@hidden positional specifiers, @code{printf} statement
address@hidden positional specifiers, @code{printf} statement, mixing with
regular formats
address@hidden precedence, regexp operators
address@hidden predefined variables, @code{-v} address@hidden setting with
address@hidden predefined variables, conveying information
address@hidden predefined variables, user-modifiable
address@hidden pretty printer, interaction with namespaces
address@hidden pretty-printing, address@hidden difference with
address@hidden print variables, in debugger
address@hidden printing, list of options
address@hidden printing, mailing labels
address@hidden printing, unduplicated lines of text
address@hidden printing, user information
address@hidden processes, two-way communications with
address@hidden profiler, interaction with namespaces
address@hidden profiling @command{awk} programs, dynamically
address@hidden profiling, address@hidden difference with
address@hidden program, definition of
address@hidden programmers, attractiveness of
address@hidden programming conventions, @code{--non-decimal-data} option
address@hidden programming conventions, @code{ARGC}/@code{ARGV} variables
address@hidden programming conventions, @code{exit} statement
address@hidden programming conventions, @command{gawk} extensions
address@hidden programming conventions, function parameters
address@hidden programming conventions, functions, calling
address@hidden programming conventions, functions, writing
address@hidden programming conventions, private variable names
address@hidden programming language, recipe for
address@hidden programming languages, Ada
address@hidden programming languages, Go
address@hidden programming languages, Java
address@hidden programming, basic steps
address@hidden programming, concepts
address@hidden qualified name, definition of
address@hidden qualified name, use of
address@hidden question mark (@code{?}), @code{?:} operator
address@hidden question mark (@code{?}), regexp operator
address@hidden quoting, for small awk programs
address@hidden quoting, in @command{gawk} command lines
address@hidden quoting, in @command{gawk} command lines, tricks for
address@hidden random numbers, @code{rand()}/@code{srand()} functions
address@hidden random numbers, Cliff
address@hidden random numbers, seed of
address@hidden range patterns, line continuation and
address@hidden record separators, changing
address@hidden record separators, newlines as
address@hidden record separators, regular expressions as
address@hidden record separators, with multiline records
address@hidden records, multiline
address@hidden records, printing
address@hidden records, splitting input into
address@hidden records, terminating
address@hidden records, treating files as
address@hidden redirect @command{gawk} output, in debugger
address@hidden reference counting, sorting arrays
address@hidden regexp constants, @code{/address@hidden/}, @code{/=} operator and
address@hidden regexp constants, as patterns
address@hidden regexp constants, in @command{gawk}
address@hidden regexp constants, slashes vs.@: quotes
address@hidden regexp constants, vs.@: string constants
address@hidden regular expressions, @command{gawk}, command-line options
address@hidden regular expressions, anchors in
address@hidden regular expressions, as field separators
address@hidden regular expressions, as patterns
address@hidden regular expressions, as record separators
address@hidden regular expressions, case sensitivity
address@hidden regular expressions, computed
address@hidden regular expressions, constants @seeentry{regexp constants}
address@hidden regular expressions, dynamic
address@hidden regular expressions, dynamic, with embedded newlines
address@hidden regular expressions, interval expressions and
address@hidden regular expressions, leftmost longest match
address@hidden regular expressions, operators
address@hidden regular expressions, operators, @command{gawk}
address@hidden regular expressions, operators, for buffers
address@hidden regular expressions, operators, for words
address@hidden regular expressions, operators, precedence of
address@hidden regular expressions, searching for
address@hidden right angle bracket (@code{>}), @code{>=} operator
address@hidden right angle bracket (@code{>}), @code{>>} operator (I/O)
address@hidden right angle bracket (@code{>}), @code{>} operator
address@hidden right angle bracket (@code{>}), @code{>} operator (I/O)
address@hidden right shift, bitwise
address@hidden rule, definition of
address@hidden search paths, for loadable extensions
address@hidden search paths, for source files
address@hidden searching, files for regular expressions
address@hidden searching, for words
address@hidden semicolon (@code{;}), @env{AWKPATH} variable and
address@hidden semicolon (@code{;}), separating rules
address@hidden semicolon (@code{;}), separating statements in actions
address@hidden separators, field
address@hidden separators, field, @code{FIELDWIDTHS} variable and
address@hidden separators, field, @code{FPAT} variable and
address@hidden separators, for records
address@hidden separators, for records, regular expressions as
address@hidden separators, for statements in actions
address@hidden separators, subscript
address@hidden shell quoting, rules for
address@hidden shells, piping commands into
address@hidden shells, quoting
address@hidden shells, quoting, rules for
address@hidden shells, scripts
address@hidden shells, sea
address@hidden shells, variables
address@hidden shift, bitwise
address@hidden show all source files, in debugger
address@hidden show function arguments, in debugger
address@hidden show local variables, in debugger
address@hidden show name of current source file, in debugger
address@hidden side effects, @code{FILENAME} variable
address@hidden side effects, @code{asort()} function
address@hidden side effects, Boolean operators
address@hidden side effects, array indexing
address@hidden side effects, assignment expressions
address@hidden side effects, conditional expressions
address@hidden side effects, decrement/increment operators
address@hidden side effects, function calls
address@hidden side effects, statements
address@hidden signals, @code{HUP}/@code{SIGHUP}, for profiling
address@hidden signals, @code{INT}/@code{SIGINT} (MS-Windows)
address@hidden signals, @code{QUIT}/@code{SIGQUIT} (MS-Windows)
address@hidden signals, @code{USR1}/@code{SIGUSR1}, for profiling
address@hidden single quote (@code{'}), in shell commands
address@hidden single quote (@code{'}), vs.@: apostrophe
address@hidden single quote (@code{'}), with double quotes
address@hidden single records, treating files as
address@hidden single-step execution, in the debugger
address@hidden sort function, arrays, sorting
address@hidden source code, @command{awka}
address@hidden source code, @command{gawk}
address@hidden source code, @command{goawk}
address@hidden source code, @command{jawk}
address@hidden source code, @command{mawk}
address@hidden source code, @command{pawk}
address@hidden source code, @command{pawk} (Python version)
address@hidden source code, Brian Kernighan's @command{awk}
address@hidden source code, BusyBox Awk
address@hidden source code, Illumos @command{awk}
address@hidden source code, QSE @command{awk}
address@hidden source code, QuikTrim Awk
address@hidden source code, Solaris @command{awk}
address@hidden source code, libmawk
address@hidden source code, mixing
address@hidden square brackets (@code{[]}), regexp operator
address@hidden statements, address@hidden control statements and
address@hidden statements, control, in actions
address@hidden statements, multiple
address@hidden stop automatic display, in debugger
address@hidden string constants, vs.@: regexp constants
address@hidden string, regular expression match
address@hidden strings splitting, example
address@hidden strings, continuation across lines
address@hidden strings, converting
address@hidden strings, converting letter case
address@hidden strings, converting, numbers to
address@hidden strings, empty @seeentry{null strings}
address@hidden strings, extracting
address@hidden strings, for localization
address@hidden strings, length limitations
address@hidden strings, merging arrays into
address@hidden strings, null
address@hidden strings, numeric
address@hidden subscripts in arrays, multidimensional
address@hidden subscripts in arrays, multidimensional, scanning
address@hidden subscripts in arrays, numbers as
address@hidden subscripts in arrays, uninitialized variables as
address@hidden text, printing
address@hidden text, printing, unduplicated lines of
address@hidden tilde (@code{~}), @code{~} operator
address@hidden time, alarm clock example program
address@hidden time, localization and
address@hidden time, managing
address@hidden time, retrieving
address@hidden timeout, reading input
address@hidden timestamps, converting dates to
address@hidden timestamps, formatted
address@hidden traceback, display in debugger
address@hidden treating files, as single records
address@hidden troubleshooting, @code{--non-decimal-data} option
address@hidden troubleshooting, @code{==} operator
address@hidden troubleshooting, @code{fflush()} function
address@hidden troubleshooting, @code{getline} function
address@hidden troubleshooting, @code{gsub()}/@code{sub()} functions
address@hidden troubleshooting, @code{match()} function
address@hidden troubleshooting, @code{print} address@hidden omitting commas
address@hidden troubleshooting, @code{substr()} function
address@hidden troubleshooting, @code{system()} function
address@hidden troubleshooting, @command{awk} uses @code{FS} not @code{IFS}
address@hidden troubleshooting, @command{gawk}
address@hidden troubleshooting, @command{gawk}, bug reports
address@hidden troubleshooting, @command{gawk}, fatal address@hidden function
arguments
address@hidden troubleshooting, backslash before nonspecial character
address@hidden troubleshooting, division
address@hidden troubleshooting, fatal errors, @code{printf} format strings
address@hidden troubleshooting, fatal errors, field address@hidden specifying
address@hidden troubleshooting, function call syntax
address@hidden troubleshooting, printing
address@hidden troubleshooting, quotes with file names
address@hidden troubleshooting, readable data files
address@hidden troubleshooting, regexp constants vs.@: string constants
address@hidden troubleshooting, string concatenation
address@hidden troubleshooting, typographical address@hidden global variables
address@hidden true, logical
address@hidden type, of variable
address@hidden underscore (@code{_}), C macro
address@hidden underscore (@code{_}), in names of private variables
address@hidden underscore (@code{_}), translatable string
address@hidden uninitialized variables, as array subscripts
address@hidden uppercase names, namespace for
address@hidden user-defined, functions, address@hidden in a profile
address@hidden user-defined, variables
address@hidden users, information about, printing
address@hidden users, information about, retrieving
address@hidden values, numeric
address@hidden values, regexp
address@hidden values, string
address@hidden variables, @code{getline} command address@hidden using
address@hidden variables, assigning on command line
address@hidden variables, built-in
address@hidden variables, flag
address@hidden variables, global, for library functions
address@hidden variables, global, printing list of
address@hidden variables, initializing
address@hidden variables, local to a function
address@hidden variables, predefined
address@hidden variables, predefined, @code{-v} address@hidden setting with
address@hidden variables, predefined, conveying information
address@hidden variables, private
address@hidden variables, setting
address@hidden variables, shadowing
address@hidden variables, types of
address@hidden variables, types of, comparison expressions and
address@hidden variables, address@hidden as array subscripts
address@hidden variables, user-defined
address@hidden vertical bar (@code{|}), @code{|&} operator (I/O)
address@hidden vertical bar (@code{|}), @code{||} operator
address@hidden vertical bar (@code{|}), @code{|} operator (I/O)
address@hidden warnings, issuing
address@hidden whitespace, as field separators
address@hidden whitespace, address@hidden calling
address@hidden whitespace, newlines as
address@hidden word, regexp definition of
address@hidden words, counting
address@hidden words, address@hidden searching for
address@hidden words, usage address@hidden generating
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index 929418c..dda299b 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -3,8 +3,7 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2019-02-23.16}
-
+\def\texinfoversion{2019-03-23.11}
%
% Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc.
%
@@ -258,8 +257,8 @@
% \domark is called twice inside \chapmacro, to add one
% mark before the section break, and one after.
-% In the second call \prevchapterdefs is the same as \lastchapterdefs,
-% and \prevsectiondefs is the same as \lastsectiondefs.
+% In the second call \prevchapterdefs is the same as \currentchapterdefs,
+% and \prevsectiondefs is the same as \currentsectiondefs.
% Then if the page is not broken at the mark, some of the previous
% section appears on the page, and we can get the name of this section
% from \firstmark for @everyheadingmarks top.
@@ -267,11 +266,11 @@
%
% See page 260 of The TeXbook.
\def\domark{%
- \toks0=\expandafter{\lastchapterdefs}%
- \toks2=\expandafter{\lastsectiondefs}%
+ \toks0=\expandafter{\currentchapterdefs}%
+ \toks2=\expandafter{\currentsectiondefs}%
\toks4=\expandafter{\prevchapterdefs}%
\toks6=\expandafter{\prevsectiondefs}%
- \toks8=\expandafter{\lastcolordefs}%
+ \toks8=\expandafter{\currentcolordefs}%
\mark{%
\the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
\noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
@@ -288,19 +287,19 @@
% @setcolor (or @url, or @link, etc.) between @contents and the very
% first @chapter.
\def\gettopheadingmarks{%
- \ifcase0\topmark\fi
+ \ifcase0\the\savedtopmark\fi
\ifx\thischapter\empty \ifcase0\firstmark\fi \fi
}
\def\getbottomheadingmarks{\ifcase1\botmark\fi}
-\def\getcolormarks{\ifcase2\topmark\fi}
+\def\getcolormarks{\ifcase2\the\savedtopmark\fi}
% Avoid "undefined control sequence" errors.
-\def\lastchapterdefs{}
-\def\lastsectiondefs{}
-\def\lastsection{}
+\def\currentchapterdefs{}
+\def\currentsectiondefs{}
+\def\currentsection{}
\def\prevchapterdefs{}
\def\prevsectiondefs{}
-\def\lastcolordefs{}
+\def\currentcolordefs{}
% Margin to add to right of even pages, to left of odd pages.
\newdimen\bindingoffset
@@ -310,11 +309,35 @@
% Main output routine.
%
\chardef\PAGE = 255
-\output = {\onepageout{\pagecontents\PAGE}}
+\newtoks\defaultoutput
+\defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}}
+\output=\expandafter{\the\defaultoutput}
\newbox\headlinebox
\newbox\footlinebox
+% When outputting the double column layout for indices, an output routine
+% is run several times, which hides the original value of \topmark. This
+% can lead to a page heading being output and duplicating the chapter heading
+% of the index. Hence, save the contents of \topmark at the beginning of
+% the output routine. The saved contents are valid until we actually
+% \shipout a page.
+%
+% (We used to run a short output routine to actually set \topmark and
+% \firstmark to the right values, but if this was called with an empty page
+% containing whatsits for writing index entries, the whatsits would be thrown
+% away and the index auxiliary file would remain empty.)
+%
+\newtoks\savedtopmark
+\newif\iftopmarksaved
+\topmarksavedtrue
+\def\savetopmark{%
+ \iftopmarksaved\else
+ \global\savedtopmark=\expandafter{\topmark}%
+ \global\topmarksavedtrue
+ \fi
+}
+
% \onepageout takes a vbox as an argument.
% \shipout a vbox for a single page, adding an optional header, footer
% and footnote. This also causes index entries for this page to be written
@@ -326,23 +349,17 @@
\ifodd\pageno \advance\hoffset by \bindingoffset
\else \advance\hoffset by -\bindingoffset\fi
%
- % Common context changes for both heading and footing.
- % Do this outside of the \shipout so @code etc. will be expanded in
- % the headline as they should be, not taken literally (outputting ''code).
- \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
- %
% Retrieve the information for the headings from the marks in the page,
% and call Plain TeX's \makeheadline and \makefootline, which use the
% values in \headline and \footline.
%
% This is used to check if we are on the first page of a chapter.
- \ifcase1\topmark\fi
+ \ifcase1\the\savedtopmark\fi
\let\prevchaptername\thischaptername
\ifcase0\firstmark\fi
\let\curchaptername\thischaptername
%
\ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
- \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
%
\ifx\curchaptername\prevchaptername
\let\thischapterheading\thischapter
@@ -353,7 +370,14 @@
\def\thischapterheading{}%
\fi
%
+ % Common context changes for both heading and footing.
+ % Do this outside of the \shipout so @code etc. will be expanded in
+ % the headline as they should be, not taken literally (outputting ''code).
+ \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
+ %
\global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
+ %
+ \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
\global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
%
{%
@@ -362,14 +386,8 @@
% take effect in \write's, yet the group defined by the \vbox ends
% before the \shipout runs.
%
- \indexdummies % don't expand commands in the output.
- \normalturnoffactive % \ in index entries must not stay \, e.g., if
- % the page break happens to be in the middle of an example.
- % We don't want .vr (or whatever) entries like this:
- % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
- % "\acronym" won't work when it's read back in;
- % it needs to be
- % {\code {{\backslashcurfont }acronym}
+ \atdummies % don't expand commands in the output.
+ \turnoffactive
\shipout\vbox{%
% Do this early so pdf references go to the beginning of the page.
\ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
@@ -384,8 +402,9 @@
\unvbox\footlinebox
\fi
%
- }% end of \shipout\vbox
- }% end of group with \indexdummies
+ }%
+ }%
+ \global\topmarksavedfalse
\advancepageno
\ifnum\outputpenalty>-20000 \else\dosupereject\fi
}
@@ -429,11 +448,10 @@
}%
}
-% First remove any @comment, then any @c comment. Also remove a @texinfoc
-% comment (see \scanmacro for details). Pass the result on to \argcheckspaces.
+% First remove any @comment, then any @c comment. Pass the result on to
+% \argcheckspaces.
\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
-\def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
-\def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
+\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
%
@@ -1105,6 +1123,16 @@ where each line of input produces a line of output.}
\fi
\fi
+\newif\ifpdforxetex
+\pdforxetexfalse
+\ifpdf
+ \pdforxetextrue
+\fi
+\ifx\XeTeXrevision\thisisundefined\else
+ \pdforxetextrue
+\fi
+
+
% PDF uses PostScript string constants for the names of xref targets,
% for display in the outlines, and in other places. Thus, we have to
% double any backslashes. Otherwise, a name like "\node" will be
@@ -1161,7 +1189,7 @@ output) for that.)}
% Set color, and create a mark which defines \thiscolor accordingly,
% so that \makeheadline knows which color to restore.
\def\setcolor#1{%
- \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
+ \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
\domark
\pdfsetcolor{#1}%
}
@@ -1169,7 +1197,7 @@ output) for that.)}
\def\maincolor{\rgbBlack}
\pdfsetcolor{\maincolor}
\edef\thiscolor{\maincolor}
- \def\lastcolordefs{}
+ \def\currentcolordefs{}
%
\def\makefootline{%
\baselineskip24pt
@@ -1547,7 +1575,7 @@ output) for that.)}
% Set color, and create a mark which defines \thiscolor accordingly,
% so that \makeheadline knows which color to restore.
\def\setcolor#1{%
- \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
+ \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
\domark
\pdfsetcolor{#1}%
}
@@ -1555,7 +1583,7 @@ output) for that.)}
\def\maincolor{\rgbBlack}
\pdfsetcolor{\maincolor}
\edef\thiscolor{\maincolor}
- \def\lastcolordefs{}
+ \def\currentcolordefs{}
%
\def\makefootline{%
\baselineskip24pt
@@ -2818,7 +2846,7 @@ end
% @t, explicit typewriter.
\def\t#1{%
- {\tt \rawbackslash \plainfrenchspacing #1}%
+ {\tt \plainfrenchspacing #1}%
\null
}
@@ -2845,7 +2873,6 @@ end
% Turn off hyphenation.
\nohyphenation
%
- \rawbackslash
\plainfrenchspacing
#1%
}%
@@ -3032,41 +3059,33 @@ end
\global\def/{\normalslash}
}
-% we put a little stretch before and after the breakable chars, to help
-% line breaking of long url's. The unequal skips make look better in
-% cmtt at least, especially for dots.
-\def\urefprestretchamount{.13em}
-\def\urefpoststretchamount{.1em}
-\def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
-\def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
-%
-\def\urefcodeamp{\urefprestretch \&\urefpoststretch}
-\def\urefcodedot{\urefprestretch .\urefpoststretch}
-\def\urefcodehash{\urefprestretch \#\urefpoststretch}
-\def\urefcodequest{\urefprestretch ?\urefpoststretch}
+\def\urefcodeamp{\urefprebreak \&\urefpostbreak}
+\def\urefcodedot{\urefprebreak .\urefpostbreak}
+\def\urefcodehash{\urefprebreak \#\urefpostbreak}
+\def\urefcodequest{\urefprebreak ?\urefpostbreak}
\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
{
\catcode`\/=\active
\global\def\urefcodeslashfinish{%
- \urefprestretch \slashChar
+ \urefprebreak \slashChar
% Allow line break only after the final / in a sequence of
% slashes, to avoid line break between the slashes in http://.
- \ifx\next/\else \urefpoststretch \fi
+ \ifx\next/\else \urefpostbreak \fi
}
}
-% One more complication: by default we'll break after the special
-% characters, but some people like to break before the special chars, so
-% allow that. Also allow no breaking at all, for manual control.
+% By default we'll break after the special characters, but some people like to
+% break before the special chars, so allow that. Also allow no breaking at
+% all, for manual control.
%
\parseargdef\urefbreakstyle{%
\def\txiarg{#1}%
\ifx\txiarg\wordnone
\def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
\else\ifx\txiarg\wordbefore
- \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
+ \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak}
\else\ifx\txiarg\wordafter
- \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
+ \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak}
\else
\errhelp = \EMsimple
\errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
@@ -3076,6 +3095,14 @@ end
\def\wordbefore{before}
\def\wordnone{none}
+% Allow a ragged right output to aid breaking long URL's. Putting stretch in
+% between characters of the URL doesn't look good.
+\def\urefallowbreak{%
+ \hskip 0pt plus 1fil\relax
+ \allowbreak
+ \hskip 0pt plus -1fil\relax
+}
+
\urefbreakstyle after
% @url synonym for @uref, since that's how everyone uses it.
@@ -3086,7 +3113,7 @@ end
% So now @email is just like @uref, unless we are pdf.
%
%\def\email#1{\angleleft{\tt #1}\angleright}
-\ifpdf
+\ifpdforxetex
\def\email#1{\doemail#1,,\finish}
\def\doemail#1,#2,#3\finish{\begingroup
\unsepspaces
@@ -3096,18 +3123,7 @@ end
\endlink
\endgroup}
\else
- \ifx\XeTeXrevision\thisisundefined
- \let\email=\uref
- \else
- \def\email#1{\doemail#1,,\finish}
- \def\doemail#1,#2,#3\finish{\begingroup
- \unsepspaces
- \pdfurl{mailto:#1}%
- \setbox0 = \hbox{\ignorespaces #2}%
- \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
- \endlink
- \endgroup}
- \fi
+ \let\email=\uref
\fi
% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
@@ -4641,19 +4657,6 @@ end
}
}
-% We have this subroutine so that we can handle at least some @value's
-% properly in indexes (we call \makevalueexpandable in \indexdummies).
-% The command has to be fully expandable (if the variable is set), since
-% the result winds up in the index file. This means that if the
-% variable's value contains other Texinfo commands, it's almost certain
-% it will fail (although perhaps we could fix that with sufficient work
-% to do a one-level expansion on the result, instead of complete).
-%
-% Unfortunately, this has the consequence that when _ is in the *value*
-% of an @set, it does not print properly in the roman fonts (get the cmr
-% dot accent at position 126 instead). No fix comes to mind, and it's
-% been this way since 2003 or earlier, so just ignore it.
-%
\def\expandablevalue#1{%
\expandafter\ifx\csname SET#1\endcsname\relax
{[No value for ``#1'']}%
@@ -4682,7 +4685,7 @@ end
% if possible, otherwise sort late.
\def\indexnofontsvalue#1{%
\expandafter\ifx\csname SET#1\endcsname\relax
- ZZZZZZZ
+ ZZZZZZZ%
\else
\csname SET#1\endcsname
\fi
@@ -4832,23 +4835,8 @@ end
\def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
-% Used when writing an index entry out to an index file to prevent
-% expansion of Texinfo commands that can appear in an index entry.
-%
-\def\indexdummies{%
- \escapechar = `\\ % use backslash in output files.
- address@hidden
- \definedummyletter\ %
- %
- % For texindex which always views { and } as separators.
- \def\{{\lbracechar{}}%
- \def\}{\rbracechar{}}%
- %
- % Do the redefinitions.
- \definedummies
-}
-
-% Used for the aux and toc files, where @ is the escape character.
+% Used for the aux, toc and index files to prevent expansion of Texinfo
+% commands.
%
\def\atdummies{%
address@hidden
@@ -4878,8 +4866,7 @@ end
\def\definedummyletter#1{\def#1{\string#1}}%
\let\definedummyaccent\definedummyletter
-% Called from \indexdummies and \atdummies, to effectively prevent
-% the expansion of commands.
+% Called from \atdummies to prevent the expansion of commands.
%
\def\definedummies{%
%
@@ -5044,11 +5031,9 @@ end
\commondummyword\xref
}
-% This does nothing, but for a time it was recommended to use
-% \usebracesinindexestrue to be able to use braces in index entries.
-
\let\indexlbrace\relax
\let\indexrbrace\relax
+\let\indexatchar\relax
address@hidden
\catcode`\\=13
@@ -5082,10 +5067,8 @@ end
}
\gdef\indexnonalnumreappear{%
- \useindexbackslash
\let-\normaldash
\let<\normalless
- address@hidden@}%
}
}
@@ -5196,36 +5179,16 @@ end
-\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
-
-% Most index entries go through here, but \dosubind is the general case.
% #1 is the index name, #2 is the entry text.
-\def\doind#1#2{\dosubind{#1}{#2}{}}
-
-% There is also \dosubind {index}{topic}{subtopic}
-% which makes an entry in a two-level index such as the operation index.
-% TODO: Two-level index? Operation index?
-
-% Workhorse for all indexes.
-% #1 is name of index, #2 is stuff to put there, #3 is subentry --
-% empty if called from \doind, as we usually are (the main exception
-% is with most defuns, which call us directly).
-%
-\def\dosubind#1#2#3{%
+\def\doind#1#2{%
\iflinks
{%
- \requireopenindexfile{#1}%
- % Store the main index entry text (including the third arg).
- \toks0 = {#2}%
- % If third arg is present, precede it with a space.
- \def\thirdarg{#3}%
- \ifx\thirdarg\empty \else
- \toks0 = \expandafter{\the\toks0 \space #3}%
- \fi
%
+ \requireopenindexfile{#1}%
\edef\writeto{\csname#1indfile\endcsname}%
%
- \safewhatsit\dosubindwrite
+ \def\indextext{#2}%
+ \safewhatsit\doindwrite
}%
\fi
}
@@ -5247,21 +5210,7 @@ end
\fi}
\def\indexisfl{fl}
-% Output \ as {\indexbackslash}, because \ is an escape character in
-% the index files.
-\let\indexbackslash=\relax
address@hidden \catcode`\\=\active
- @address@hidden@address@hidden
-}
-
-% Definition for writing index entry text.
-\def\sortas#1{\ignorespaces}%
-
-% Definition for writing index entry sort key. Should occur at the at
-% the beginning of the index entry, like
-% @cindex @sortas{september} \september
-% The \ignorespaces takes care of following space, but there's no way
-% to remove space before it.
+% Definition for writing index entry sort key.
{
\catcode`\-=13
\gdef\indexwritesortas{%
@@ -5272,51 +5221,128 @@ end
\xdef\indexsortkey{#1}\endgroup}
}
+\def\indexwriteseealso#1{
+ address@hidden
+}
+\def\indexwriteseeentry#1{
+ address@hidden
+}
+
+% The default definitions
+\def\sortas#1{}%
+\def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
+\def\putwordSeeAlso{See also}
+\def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only
-% Write the entry in \toks0 to the index file.
+
+% Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
+% * Set \bracedtext to "{aaa}{bbb}"
+% * Set \fullindexsortkey to "aaa @subentry ZZZ"
+% * If @seealso occurs, set \pagenumbertext
%
-\def\dosubindwrite{%
- % Put the index entry in the margin if desired.
- \ifx\SETmarginindex\relax\else
- \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
+\def\splitindexentry#1{%
+ \gdef\fullindexsortkey{}%
+ \xdef\bracedtext{}%
+ \def\sep{}%
+ \def\seealso##1{}%
+ \def\seeentry##1{}%
+ \expandafter\doindexsegment#1\subentry\finish\subentry
+}
+
+% append the results from the next segment
+\def\doindexsegment#1\subentry{%
+ \def\segment{#1}%
+ \ifx\segment\isfinish
+ \else
+ %
+ % Fully expand the segment, throwing away any @sortas directives, and
+ % trim spaces.
+ \edef\trimmed{\segment}%
+ \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
+ %
+ \xdef\bracedtext{\bracedtext{\trimmed}}%
+ %
+ % Get the string to sort by. Process the segment with all
+ % font commands turned off.
+ \bgroup
+ \let\sortas\indexwritesortas
+ \let\seealso\indexwriteseealso
+ \let\seeentry\indexwriteseeentry
+ \indexnofonts
+ % The braces around the commands are recognized by texindex.
+ \def\lbracechar{{\indexlbrace}}%
+ \def\rbracechar{{\indexrbrace}}%
+ \let\{=\lbracechar
+ \let\}=\rbracechar
+ address@hidden
+ address@hidden
+ %
+ \let\indexsortkey\empty
+ \global\let\pagenumbertext\empty
+ % Execute the segment and throw away the typeset output. This executes
+ % any @sortas or @seealso commands in this segment.
+ \setbox\dummybox = \hbox{\segment}%
+ \ifx\indexsortkey\empty{%
+ \indexnonalnumdisappear
+ \xdef\trimmed{\segment}%
+ \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
+ \xdef\indexsortkey{\trimmed}%
+ \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
+ }\fi
+ %
+ % Append to \fullindexsortkey.
+ \edef\tmp{\gdef\noexpand\fullindexsortkey{%
+ \fullindexsortkey\sep\indexsortkey}}%
+ \tmp
+ \egroup
+ \def\sep{\subentry}%
+ %
+ \expandafter\doindexsegment
\fi
+}
+\def\isfinish{\finish}%
+\newbox\dummybox % used above
+
+\let\subentry\relax
+
+% Write the entry in \toks0 to the index file.
+%
+\def\doindwrite{%
+ \maybemarginindex
%
- % Remember, we are within a group.
- \indexdummies % Must do this here, since \bf, etc expand at this stage
- \useindexbackslash % \indexbackslash isn't defined now so it will be output
- % as is; and it will print as backslash.
- % The braces around \indexbrace are recognized by texindex.
- %
- % Get the string to sort by, by processing the index entry with all
- % font commands turned off.
- {\indexnofonts
- \def\lbracechar{{\indexlbrace}}%
- \def\rbracechar{{\indexrbrace}}%
- \let\{=\lbracechar
- \let\}=\rbracechar
- \indexnonalnumdisappear
- \xdef\indexsortkey{}%
- \let\sortas=\indexwritesortas
- \edef\temp{\the\toks0}%
- \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
- \ifx\indexsortkey\empty
- \xdef\indexsortkey{\temp}%
- \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
- \fi
- }%
+ \atdummies
+ %
+ % For texindex which always views { and } as separators.
+ \def\{{\lbracechar{}}%
+ \def\}{\rbracechar{}}%
+ %
+ % Split the entry into primary entry and any subentries, and get the index
+ % sort key.
+ \splitindexentry\indextext
%
% Set up the complete index entry, with both the sort key and
% the original text, including any font commands. We write
% three arguments to \entry to the .?? file (four in the
% subentry case), texindex reduces to two when writing the .??s
% sorted result.
+ %
\edef\temp{%
\write\writeto{%
- \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
+ \string\entry{\fullindexsortkey}%
+ {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
+ \bracedtext}%
}%
\temp
}
-\newbox\dummybox % used above
+
+% Put the index entry in the margin if desired (undocumented).
+\def\maybemarginindex{%
+ \ifx\SETmarginindex\relax\else
+ \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}%
+ \fi
+}
+\let\SETmarginindex=\relax
+
% Take care of unwanted page breaks/skips around a whatsit:
%
@@ -5404,9 +5430,14 @@ end
% \entry {topic}{pagelist}
% for a topic that is used without subtopics
% \primary {topic}
+% \entry {topic}{}
% for the beginning of a topic that is used with subtopics
% \secondary {subtopic}{pagelist}
% for each subtopic.
+% \secondary {subtopic}{}
+% for a subtopic with sub-subtopics
+% \tertiary {subtopic}{subsubtopic}{pagelist}
+% for each sub-subtopic.
% Define the user-accessible indexing commands
% @findex, @vindex, @kindex, @cindex.
@@ -5418,11 +5449,6 @@ end
\def\tindex {\tpindex}
\def\pindex {\pgindex}
-\def\cindexsub {\begingroup\obeylines\cindexsub}
-{\obeylines %
-\gdef\cindexsub "#1" #2^^M{\endgroup %
-\dosubind{cp}{#2}{#1}}}
-
% Define the macros used in formatting output of the sorted index material.
% @printindex causes a particular index (the ??s file) to get printed.
@@ -5436,14 +5462,10 @@ end
\plainfrenchspacing
\everypar = {}% don't want the \kern\-parindent from indentation suppression.
%
- % See if the index file exists and is nonempty.
- % Change catcode of @ here so that if the index file contains
- % \initial address@hidden
- % as its first line, TeX doesn't complain about mismatched braces
- % (because it thinks @} is a control sequence).
- \catcode`\@ = 12
% See comment in \requireopenindexfile.
\def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
+ %
+ % See if the index file exists and is nonempty.
\openin 1 \jobname.\indexname s
\ifeof 1
% \enddoublecolumns gets confused if there is no text in the index,
@@ -5453,8 +5475,6 @@ end
\putwordIndexNonexistent
\typeout{No file \jobname.\indexname s.}%
\else
- \catcode`\\ = 0
- %
% If the index file exists but is empty, then \openin leaves \ifeof
% false. We have to make TeX try to read something from the file, so
% it can discover if there is anything in it.
@@ -5462,47 +5482,27 @@ end
\ifeof 1
\putwordIndexIsEmpty
\else
- % Index files are almost Texinfo source, but we use \ as the escape
- % character. It would be better to use @, but that's too big a change
- % to make right now.
- \def\indexbackslash{\ttbackslash}%
- \let\indexlbrace\{ % Likewise, set these sequences for braces
- \let\indexrbrace\} % used in the sort key.
- \begindoublecolumns
- \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty
- %
- % Read input from the index file line by line.
- \loopdo
- \ifeof1 \else
- \read 1 to \nextline
- \fi
- %
- \indexinputprocessing
- \thisline
- %
- \ifeof1\else
- \let\thisline\nextline
- \repeat
- %%
- \enddoublecolumns
+ \expandafter\printindexzz\thisline\relax\relax\finish%
\fi
\fi
\closein 1
\endgroup}
-\def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
-\def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
-\def\indexinputprocessing{%
- \ifeof1
- \let\firsttoken\relax
+% If the index file starts with a backslash, forgo reading the index
+% file altogether. If somebody upgrades texinfo.tex they may still have
+% old index files using \ as the escape character. Reading this would
+% at best lead to typesetting garbage, at worst a TeX syntax error.
+\def\printindexzz#1#2\finish{%
+ % NB this won't work if the index file starts with a group...
+ \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
+ \message{skipping sorted index file}%
+ (Skipped sorted index file in obsolete format)
\else
- \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
- \act
+ \begindoublecolumns
+ \input \jobname.\indexname s
+ \enddoublecolumns
\fi
}
-\def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
-\long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
-
% These macros are used by the sorted index file itself.
% Change them to control the appearance of the index.
@@ -5511,12 +5511,18 @@ end
\catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
\catcode`\$=3
\gdef\initialglyphs{%
+ % special control sequences used in the index sort key
+ \let\indexlbrace\{%
+ \let\indexrbrace\}%
+ address@hidden
+ %
% Some changes for non-alphabetic characters. Using the glyphs from the
% math fonts looks more consistent than the typewriter font used elsewhere
% for these characters.
- \def\indexbackslash{\math{\backslash}}%
- \let\\=\indexbackslash
+ \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}}
%
+ % In case @\ is used for backslash
+ \uppercase{\let\\=~}
% Can't get bold backslash so don't use bold forward slash
\catcode`\/=13
\def/{{\secrmnotbold \normalslash}}%
@@ -5576,12 +5582,6 @@ end
\def\entry{%
\begingroup
%
- % For pdfTeX and XeTeX.
- % The redefinition of \domark stops marks being added in \pdflink to
- % preserve coloured links across page boundaries. Otherwise the marks
- % would get in the way of \lastbox in \insertentrybox.
- \let\domark\relax
- %
% Start a new paragraph if necessary, so our assignments below can't
% affect previous text.
\par
@@ -5614,35 +5614,31 @@ end
\gdef\finishentry#1{%
\egroup % end box A
\dimen@ = \wd\boxA % Length of text of entry
- \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
- % #1 is the page number.
- %
- % Get the width of the page numbers, and only use
- % leaders if they are present.
- \global\setbox\boxB = \hbox{#1}%
- \ifdim\wd\boxB = 0pt
- \null\nobreak\hfill\ %
- \else
- %
- \null\nobreak\indexdotfill % Have leaders before the page number.
+ \global\setbox\boxA=\hbox\bgroup
+ \unhbox\boxA
+ % #1 is the page number.
%
- \ifpdf
- \pdfgettoks#1.%
- \hskip\skip\thinshrinkable\the\toksA
+ % Get the width of the page numbers, and only use
+ % leaders if they are present.
+ \global\setbox\boxB = \hbox{#1}%
+ \ifdim\wd\boxB = 0pt
+ \null\nobreak\hfill\ %
\else
- \ifx\XeTeXrevision\thisisundefined
- \hskip\skip\thinshrinkable #1%
- \else
+ %
+ \null\nobreak\indexdotfill % Have leaders before the page number.
+ %
+ \ifpdforxetex
\pdfgettoks#1.%
\hskip\skip\thinshrinkable\the\toksA
+ \else
+ \hskip\skip\thinshrinkable #1%
\fi
\fi
- \fi
\egroup % end \boxA
\ifdim\wd\boxB = 0pt
- \global\setbox\entrybox=\vbox{\unhbox\boxA}%
- \else
- \global\setbox\entrybox=\vbox\bgroup
+ \noindent\unhbox\boxA\par
+ \nobreak
+ \else\bgroup
% We want the text of the entries to be aligned to the left, and the
% page numbers to be aligned to the right.
%
@@ -5708,55 +5704,11 @@ end
\egroup % The \vbox
\fi
\endgroup
- \dotheinsertentrybox
}}
\newskip\thinshrinkable
\skip\thinshrinkable=.15em minus .15em
-\newbox\entrybox
-\def\insertentrybox{%
- \ourunvbox\entrybox
-}
-
-% default definition
-\let\dotheinsertentrybox\insertentrybox
-
-% Use \lastbox to take apart vbox box by box, and add each sub-box
-% to the current vertical list.
-\def\ourunvbox#1{%
-\bgroup % for local binding of \delayedbox
- % Remove the last box from box #1
- \global\setbox#1=\vbox{%
- \unvbox#1%
- \unskip % remove any glue
- \unpenalty
- \global\setbox\interbox=\lastbox
- }%
- \setbox\delayedbox=\box\interbox
- \ifdim\ht#1=0pt\else
- \ourunvbox#1 % Repeat on what's left of the box
- \nobreak
- \fi
- \box\delayedbox
-\egroup
-}
-\newbox\delayedbox
-\newbox\interbox
-
-% Used from \printindex. \firsttoken should be the first token
-% after the \entry. If it's not another \entry, we are at the last
-% line of a group of index entries, so insert a penalty to discourage
-% widowed index entries.
-\def\dotheinsertentryboxwithpenalty{%
- \ifx\firsttoken\isentry
- \else
- \penalty 9000
- \fi
- \insertentrybox
-}
-\def\isentry{\entry}%
-
% Like plain.tex's \dotfill, except uses up at least 1 em.
% The filll stretch here overpowers both the fil and fill stretch to push
% the page number to the right.
@@ -5766,24 +5718,15 @@ end
\def\primary #1{\line{#1\hfil}}
-\newskip\secondaryindent \secondaryindent=0.5cm
-\def\secondary#1#2{{%
- \parfillskip=0in
- \parskip=0in
- \hangindent=1in
- \hangafter=1
- \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
- \ifpdf
- \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
- \else
- \ifx\XeTeXrevision\thisisundefined
- #2
- \else
- \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
- \fi
- \fi
- \par
-}}
+\def\secondary{\indententry{0.5cm}}
+\def\tertiary{\indententry{1cm}}
+
+\def\indententry#1#2#3{%
+ \bgroup
+ \leftskip=#1
+ \entry{#2}{#3}%
+ \egroup
+}
% Define two-column mode, which we use to typeset indexes.
% Adapted from the TeXbook, page 416, which is to say,
@@ -5793,60 +5736,21 @@ end
\newbox\partialpage
\newdimen\doublecolumnhsize
-% Use inside an output routine to save \topmark and \firstmark
-\def\savemarks{%
- \global\savedtopmark=\expandafter{\topmark }%
- \global\savedfirstmark=\expandafter{\firstmark }%
-}
-\newtoks\savedtopmark
-\newtoks\savedfirstmark
-
-% Set \topmark and \firstmark for next time \output runs.
-% Can't be run from withinside \output (because any material
-% added while an output routine is active, including
-% penalties, is saved for after it finishes). The page so far
-% should be empty, otherwise what's on it will be thrown away.
-\def\restoremarks{%
- \mark{\the\savedtopmark}%
- \bgroup\output = {%
- \setbox\dummybox=\box\PAGE
- }abc\eject\egroup
- % "abc" because output routine doesn't fire for a completely empty page.
- \mark{\the\savedfirstmark}%
-}
-
\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
% If not much space left on page, start a new page.
\ifdim\pagetotal>0.8\vsize\vfill\eject\fi
%
% Grab any single-column material above us.
\output = {%
- %
- % Here is a possibility not foreseen in manmac: if we accumulate a
- % whole lot of material, we might end up calling this \output
- % routine twice in a row (see the doublecol-lose test, which is
- % essentially a couple of indexes with @setchapternewpage off). In
- % that case we just ship out what is in \partialpage with the normal
- % output routine. Generally, \partialpage will be empty when this
- % runs and this will be a no-op. See the indexspread.tex test case.
- \ifvoid\partialpage \else
- \onepageout{\pagecontents\partialpage}%
- \fi
+ \savetopmark
%
\global\setbox\partialpage = \vbox{%
% Unvbox the main output page.
\unvbox\PAGE
\kern-\topskip \kern\baselineskip
}%
- \savemarks
}%
\eject % run that output routine to set \partialpage
- \restoremarks
- %
- % We recover the two marks that the last output routine saved in order
- % to propagate the information in marks added around a chapter heading,
- % which could be otherwise be lost by the time the final page is output.
- %
%
% Use the double-column output routine for subsequent pages.
\output = {\doublecolumnout}%
@@ -5887,6 +5791,7 @@ end
%
\def\doublecolumnout{%
%
+ \savetopmark
\splittopskip=\topskip \splitmaxdepth=\maxdepth
\dimen@ = \vsize
\divide\dimen@ by 2
@@ -5942,7 +5847,7 @@ end
%
\output = {%
% Split the last of the double-column material.
- \savemarks
+ \savetopmark
\balancecolumns
}%
\eject % call the \output just set
@@ -5950,10 +5855,9 @@ end
% Having called \balancecolumns once, we do not
% want to call it again. Therefore, reset \output to its normal
% definition right away.
- \global\output = {\onepageout{\pagecontents\PAGE}}%
+ \global\output=\expandafter{\the\defaultoutput}
%
\endgroup % started in \begindoublecolumns
- \restoremarks
% Leave the double-column material on the current page, no automatic
% page break.
\box\balancedcolumns
@@ -6119,11 +6023,9 @@ end
% @raisesections: treat @section as chapter, @subsection as section, etc.
\def\raisesections{\global\advance\secbase by -1}
-\let\up=\raisesections % original BFox name
% @lowersections: treat @chapter as section, @section as subsection, etc.
\def\lowersections{\global\advance\secbase by 1}
-\let\down=\lowersections % original BFox name
% we only have subsub.
\chardef\maxseclevel = 3
@@ -6468,27 +6370,22 @@ end
\expandafter\ifx\thisenv\titlepage\else
\checkenv{}% chapters, etc., should not start inside an environment.
\fi
- % FIXME: \chapmacro is currently called from inside \titlepage when
- % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
- % this should probably be done by \sectionheading with an option to print
- % in chapter size.
- %
% Insert the first mark before the heading break (see notes for \domark).
- \let\prevchapterdefs=\lastchapterdefs
- \let\prevsectiondefs=\lastsectiondefs
- \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
+ \let\prevchapterdefs=\currentchapterdefs
+ \let\prevsectiondefs=\currentsectiondefs
+ \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
\gdef\thissection{}}%
%
\def\temptype{#2}%
\ifx\temptype\Ynothingkeyword
- \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
+ \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
\gdef\thischapter{\thischaptername}}%
\else\ifx\temptype\Yomitfromtockeyword
- \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
+ \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
\gdef\thischapter{}}%
\else\ifx\temptype\Yappendixkeyword
\toks0={#1}%
- \xdef\lastchapterdefs{%
+ \xdef\currentchapterdefs{%
\gdef\noexpand\thischaptername{\the\toks0}%
\gdef\noexpand\thischapternum{\appendixletter}%
% \noexpand\putwordAppendix avoids expanding indigestible
@@ -6499,7 +6396,7 @@ end
}%
\else
\toks0={#1}%
- \xdef\lastchapterdefs{%
+ \xdef\currentchapterdefs{%
\gdef\noexpand\thischaptername{\the\toks0}%
\gdef\noexpand\thischapternum{\the\chapno}%
% \noexpand\putwordChapter avoids expanding indigestible
@@ -6519,18 +6416,18 @@ end
%
% Now the second mark, after the heading break. No break points
% between here and the heading.
- \let\prevchapterdefs=\lastchapterdefs
- \let\prevsectiondefs=\lastsectiondefs
+ \let\prevchapterdefs=\currentchapterdefs
+ \let\prevsectiondefs=\currentsectiondefs
\domark
%
{%
\chapfonts \rm
\let\footnote=\errfootnoteheading % give better error message
%
- % Have to define \lastsection before calling \donoderef, because the
+ % Have to define \currentsection before calling \donoderef, because the
% xref code eventually uses it. On the other hand, it has to be called
% after \pchapsepmacro, or the headline will change too soon.
- \gdef\lastsection{#1}%
+ \gdef\currentsection{#1}%
%
% Only insert the separating space if we have a chapter/appendix
% number, and don't print the unnumbered ``number''.
@@ -6619,10 +6516,10 @@ end
\csname #2fonts\endcsname \rm
%
% Insert first mark before the heading break (see notes for \domark).
- \let\prevsectiondefs=\lastsectiondefs
+ \let\prevsectiondefs=\currentsectiondefs
\ifx\temptype\Ynothingkeyword
\ifx\sectionlevel\seckeyword
- \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
+
\gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
\gdef\thissection{\thissectionname}}%
\fi
\else\ifx\temptype\Yomitfromtockeyword
@@ -6630,7 +6527,7 @@ end
\else\ifx\temptype\Yappendixkeyword
\ifx\sectionlevel\seckeyword
\toks0={#1}%
- \xdef\lastsectiondefs{%
+ \xdef\currentsectiondefs{%
\gdef\noexpand\thissectionname{\the\toks0}%
\gdef\noexpand\thissectionnum{#4}%
% \noexpand\putwordSection avoids expanding indigestible
@@ -6643,7 +6540,7 @@ end
\else
\ifx\sectionlevel\seckeyword
\toks0={#1}%
- \xdef\lastsectiondefs{%
+ \xdef\currentsectiondefs{%
\gdef\noexpand\thissectionname{\the\toks0}%
\gdef\noexpand\thissectionnum{#4}%
% \noexpand\putwordSection avoids expanding indigestible
@@ -6669,28 +6566,28 @@ end
%
% Now the second mark, after the heading break. No break points
% between here and the heading.
- \global\let\prevsectiondefs=\lastsectiondefs
+ \global\let\prevsectiondefs=\currentsectiondefs
\domark
%
% Only insert the space after the number if we have a section number.
\ifx\temptype\Ynothingkeyword
\setbox0 = \hbox{}%
\def\toctype{unn}%
- \gdef\lastsection{#1}%
+ \gdef\currentsection{#1}%
\else\ifx\temptype\Yomitfromtockeyword
% for @headings -- no section number, don't include in toc,
- % and don't redefine \lastsection.
+ % and don't redefine \currentsection.
\setbox0 = \hbox{}%
\def\toctype{omit}%
\let\sectionlevel=\empty
\else\ifx\temptype\Yappendixkeyword
\setbox0 = \hbox{#4\enspace}%
\def\toctype{app}%
- \gdef\lastsection{#1}%
+ \gdef\currentsection{#1}%
\else
\setbox0 = \hbox{#4\enspace}%
\def\toctype{num}%
- \gdef\lastsection{#1}%
+ \gdef\currentsection{#1}%
\fi\fi\fi
%
% Write the toc entry (before \donoderef). See comments in \chapmacro.
@@ -6780,13 +6677,8 @@ end
% 1 and 2 (the page numbers aren't printed), and so are the first
% two pages of the document. Thus, we'd have two destinations named
% `1', and two named `2'.
- \ifpdf
+ \ifpdforxetex
\global\pdfmakepagedesttrue
- \else
- \ifx\XeTeXrevision\thisisundefined
- \else
- \global\pdfmakepagedesttrue
- \fi
\fi
}
@@ -7149,11 +7041,7 @@ end
% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
% environment contents.
-\font\circle=lcircle10
-\newdimen\circthick
-\newdimen\cartouter\newdimen\cartinner
-\newskip\normbskip\newskip\normpskip\newskip\normlskip
-\circthick=\fontdimen8\circle
+
%
\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
\def\ctr{{\hskip 6pt\circle\char'010}}
@@ -7168,7 +7056,18 @@ end
%
\newskip\lskip\newskip\rskip
+% only require the font if @cartouche is actually used
+\def\cartouchefontdefs{%
+ \font\circle=lcircle10\relax
+ \circthick=\fontdimen8\circle
+}
+\newdimen\circthick
+\newdimen\cartouter\newdimen\cartinner
+\newskip\normbskip\newskip\normpskip\newskip\normlskip
+
+
\envdef\cartouche{%
+ \cartouchefontdefs
\ifhmode\par\fi % can't be in the midst of a paragraph.
\startsavinginserts
\lskip=\leftskip \rskip=\rightskip
@@ -7347,13 +7246,9 @@ end
% @raggedright does more-or-less normal line breaking but no right
-% justification. From plain.tex. Don't stretch around special
-% characters in urls in this environment, since the stretch at the right
-% should be enough.
+% justification. From plain.tex.
\envdef\raggedright{%
\rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
- \def\urefprestretchamount{0pt}%
- \def\urefpoststretchamount{0pt}%
}
\let\Eraggedright\par
@@ -7728,6 +7623,21 @@ end
\fi\fi
}
+% \dosubind {index}{topic}{subtopic}
+%
+% If SUBTOPIC is present, precede it with a space, and call \doind.
+% (At some time during the 20th century, this made a two-level entry in an
+% index such as the operation index. Nobody seemed to notice the change in
+% behaviour though.)
+\def\dosubind#1#2#3{%
+ \def\thirdarg{#3}%
+ \ifx\thirdarg\empty
+ \doind{#1}{#2}%
+ \else
+ \doind{#1}{#2\space#3}%
+ \fi
+}
+
% Untyped functions:
% @deffn category name args
@@ -7742,7 +7652,6 @@ end
% \deffngeneral {subind}category name args
%
\def\deffngeneral#1#2 #3 #4\endheader{%
- % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
\dosubind{fn}{\code{#3}}{#1}%
\defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
}
@@ -8030,36 +7939,18 @@ end
}
\fi
-% alias because \c means cedilla in @tex or @math
-\let\texinfoc=\c
-
-\newcount\savedcatcodeone
-\newcount\savedcatcodetwo
-
% Used at the time of macro expansion.
% Argument is macro body with arguments substituted
\def\scanmacro#1{%
\newlinechar`\^^M
\def\xeatspaces{\eatspaces}%
%
- % Temporarily undo catcode changes of \printindex. Set catcode of @ to
- % 0 so that @-commands in macro expansions aren't printed literally when
- % formatting an index file, where \ is used as the escape character.
- \savedcatcodeone=\catcode`\@
- \savedcatcodetwo=\catcode`\\
- address@hidden
- \catcode`\\=\active
- %
% Process the macro body under the current catcode regime.
- address@hidden
- %
- address@hidden
- \catcode`\\=\savedcatcodetwo
+ address@hidden
%
- % The \texinfoc is to remove the \newlinechar added by \scantokens, and
- % can be noticed by \parsearg.
- % We avoid surrounding the call to \scantokens with \bgroup and \egroup
- % to allow macros to open or close groups themselves.
+ % The \comment is to remove the \newlinechar added by \scantokens, and
+ % can be noticed by \parsearg. Note \c isn't used because this means
cedilla
+ % in math mode.
}
% Used for copying and captions
@@ -8160,12 +8051,14 @@ end
\def\macroargctxt{%
\scanctxt
\catcode`\ =\active
+ address@hidden
\catcode`\^^M=\other
\catcode`\\=\active
}
\def\macrolineargctxt{% used for whole-line arguments without braces
\scanctxt
+ address@hidden
\catcode`\{=\other
\catcode`\}=\other
}
@@ -8729,9 +8622,21 @@ end
% also remove a trailing comma, in case of something like this:
% @node Help-Cross, , , Cross-refs
\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
-\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
+\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode}
+
+% Used so that the @top node doesn't have to be wrapped in an @ifnottex
+% conditional.
+% \doignore goes to more effort to skip nested conditionals but we don't need
+% that here.
+\def\omittopnode{%
+ \ifx\lastnode\wordTop
+ \expandafter\ignorenode\fi
+}
+\def\wordTop{Top}
+
+% Divert output to a box that is not output until the next @node command.
+\def\ignorenode{\setbox\dummybox\vbox\bgroup\def\node{\egroup\node}}
-\let\nwnode=\node
\let\lastnode=\empty
% Write a cross-reference definition for the current node. #1 is the
@@ -8754,7 +8659,7 @@ end
% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
% anchor), which consists of three parts:
-% 1) NAME-title - the current sectioning name taken from \lastsection,
+% 1) NAME-title - the current sectioning name taken from \currentsection,
% or the anchor name.
% 2) NAME-snt - section number and type, passed as the SNT arg, or
% empty for anchors.
@@ -8776,7 +8681,7 @@ end
address@hidden #1 of \setref, expanded by the \edef
##1}{##2}}% these are parameters of \writexrdef
}%
- \toks0 = \expandafter{\lastsection}%
+ \toks0 = \expandafter{\currentsection}%
\immediate \writexrdef{title}{\the\toks0 }%
\immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
\safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
@@ -9206,19 +9111,6 @@ end
\catcode`\^^]=\other
\catcode`\^^^=\other
\catcode`\^^_=\other
- % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
- % in xref tags, i.e., node names. But since ^^e4 notation isn't
- % supported in the main text, it doesn't seem desirable. Furthermore,
- % that is not enough: for node names that actually contain a ^
- % character, we would end up writing a line like this: 'xrdef {'hat
- % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
- % argument, and \hat is not an expandable control sequence. It could
- % all be worked out, but why? Either we support ^^ or we don't.
- %
- % The other change necessary for this was to define \auxhat:
- % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
- % and then to call \auxhat in \setq.
- %
\catcode`\^=\other
%
% Special characters. Should be turned off anyway, but...
@@ -9236,14 +9128,7 @@ end
\catcode`\%=\other
\catcode`+=\other % avoid \+ for paranoia even though we've turned it off
%
- % This is to support \ in node names and titles, since the \
- % characters end up in a \csname. It's easier than
- % leaving it active and making its active definition an actual \
- % character. What I don't understand is why it works in the *value*
- % of the xrdef. Seems like it should be a catcode12 \, and that
- % should not typeset properly. But it works, so I'm moving on for
- % now. --karl, 15jan04.
- \catcode`\\=\other
+ \catcode`\\=\active
%
% @ is our escape character in .aux files, and we need braces.
\catcode`\{=1
@@ -9574,13 +9459,13 @@ end
\global\advance\floatno by 1
%
{%
- % This magic value for \lastsection is output by \setref as the
+ % This magic value for \currentsection is output by \setref as the
% XREFLABEL-title value. \xrefX uses it to distinguish float
% labels (which have a completely different output format) from
% node and anchor labels. And \xrdef uses it to construct the
% lists of floats.
%
- \edef\lastsection{\floatmagic=\safefloattype}%
+ \edef\currentsection{\floatmagic=\safefloattype}%
\setref{\floatlabel}{Yfloat}%
}%
\fi
@@ -9703,7 +9588,7 @@ end
% #1 is the control sequence we are passed; we expand into a conditional
% which is true if #1 represents a float ref. That is, the magic
-% \lastsection value which we \setref above.
+% \currentsection value which we \setref above.
%
\def\iffloat#1{\expandafter\doiffloat#1==\finish}
%
@@ -11514,11 +11399,9 @@ directory should work if nowhere else does.}
% \backslashcurfont outputs one backslash character in current font,
% as in \char`\\.
\global\chardef\backslashcurfont=`\\
-\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
-% \realbackslash is an actual character `\' with catcode other, and
-% \doublebackslash is two of them (for the pdf outlines).
-{\catcode`\\=\other @address@hidden @address@hidden
+% \realbackslash is an actual character `\' with catcode other.
+{\catcode`\\=\other @address@hidden
% In Texinfo, backslash is an active character; it prints the backslash
% in fixed width font.
@@ -11536,10 +11419,8 @@ directory should work if nowhere else does.}
@address@hidden@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
@address@hidden = @ttbackslash % @backslashchar{} is for user documents.
-% \rawbackslash defines an active \ to do \backslashcurfont.
% \otherbackslash defines an active \ to be a literal `\' character with
-% catcode other. We switch back and forth between these.
address@hidden@address@hidden@backslashcurfont}
+% catcode other.
@address@hidden@address@hidden
% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
@@ -11611,7 +11492,7 @@ directory should work if nowhere else does.}
@address@hidden @let\ = @ttbackslash @fi
@catcode13=5 % regular end of line
@enableemergencynewline
- @address@hidden@texinfoc
+ @address@hidden@comment
@address@hidden@originalparsearg
% Also turn back on active characters that might appear in the input
% file name, in case not using a pre-dumped format.
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=6167e5e065ecf16a8f9567046d563a89ecbf996c
commit 6167e5e065ecf16a8f9567046d563a89ecbf996c
Merge: 6c6f6eb 8952c58
Author: Arnold D. Robbins <address@hidden>
Date: Fri Mar 29 14:45:05 2019 +0300
Merge branch 'master' into feature/better-index
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=6c6f6eb628de5deef8bd382b26270cf91fe82adb
commit 6c6f6eb628de5deef8bd382b26270cf91fe82adb
Author: Arnold D. Robbins <address@hidden>
Date: Sat Mar 9 20:47:12 2019 +0200
Doc improvements w.r.t. interval expressions.
diff --git a/doc/ChangeLog b/doc/ChangeLog
index d62a388..702ff6e 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-09 Arnold D. Robbins <address@hidden>
+
+ * gawktexi.in (Regexp Operators): Refactor a bit into subsections,
+ mention that BWK awk now has interval expressions.
+
2019-02-28 Arnold D. Robbins <address@hidden>
* gawktexi.in: Fix a spelling error, change update month.
diff --git a/doc/gawk.info b/doc/gawk.info
index 941d684..e93c6e2 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -3647,7 +3647,18 @@ You can combine regular expressions with special
characters, called
"regular expression operators" or "metacharacters", to increase the
power and versatility of regular expressions.
- The escape sequences described in *note Escape Sequences:: are valid
+* Menu:
+
+* Regexp Operator Details:: The actual details.
+* Interval Expressions:: Notes on interval expressions.
+
+
+File: gawk.info, Node: Regexp Operator Details, Next: Interval Expressions,
Up: Regexp Operators
+
+3.3.1 Regexp Operators in 'awk'
+-------------------------------
+
+The escape sequences described in *note Escape Sequences:: are valid
inside a regexp. They are introduced by a '\' and are recognized and
converted into corresponding real characters as the very first step in
processing regexps.
@@ -3772,27 +3783,6 @@ sequences and that are not listed here stand for
themselves:
'wh{2,}y'
Matches 'whhy', 'whhhy', and so on.
- Interval expressions were not traditionally available in 'awk'.
- They were added as part of the POSIX standard to make 'awk' and
- 'egrep' consistent with each other.
-
- Initially, because old programs may use '{' and '}' in regexp
- constants, 'gawk' did _not_ match interval expressions in regexps.
-
- However, beginning with version 4.0, 'gawk' does match interval
- expressions by default. This is because compatibility with POSIX
- has become more important to most 'gawk' users than compatibility
- with old programs.
-
- For programs that use '{' and '}' in regexp constants, it is good
- practice to always escape them with a backslash. Then the regexp
- constants are valid and work the way you want them to, using any
- version of 'awk'.(2)
-
- Finally, when '{' and '}' appear in regexp constants in a way that
- cannot be interpreted as an interval expression (such as '/q{a}/'),
- then they stand for themselves.
-
In regular expressions, the '*', '+', and '?' operators, as well as
the braces '{' and '}', have the highest precedence, followed by
concatenation, and finally by '|'. As in arithmetic, parentheses can
@@ -3803,15 +3793,49 @@ themselves when there is nothing in the regexp that
precedes them. For
example, '/+/' matches a literal plus sign. However, many other
versions of 'awk' treat such a usage as a syntax error.
- If 'gawk' is in compatibility mode (*note Options::), interval
-expressions are not available in regular expressions.
-
---------- Footnotes ----------
(1) In other literature, you may see a bracket expression referred to
as either a "character set", a "character class", or a "character list".
- (2) Use two backslashes if you're using a string constant with a
+
+File: gawk.info, Node: Interval Expressions, Prev: Regexp Operator Details,
Up: Regexp Operators
+
+3.3.2 Some Notes On Interval Expressions
+----------------------------------------
+
+Interval expressions were not traditionally available in 'awk'. They
+were added as part of the POSIX standard to make 'awk' and 'egrep'
+consistent with each other.
+
+ Initially, because old programs may use '{' and '}' in regexp
+constants, 'gawk' did _not_ match interval expressions in regexps.
+
+ However, beginning with version 4.0, 'gawk' does match interval
+expressions by default. This is because compatibility with POSIX has
+become more important to most 'gawk' users than compatibility with old
+programs.
+
+ For programs that use '{' and '}' in regexp constants, it is good
+practice to always escape them with a backslash. Then the regexp
+constants are valid and work the way you want them to, using any version
+of 'awk'.(1)
+
+ Finally, when '{' and '}' appear in regexp constants in a way that
+cannot be interpreted as an interval expression (such as '/q{a}/'), then
+they stand for themselves.
+
+ As mentioned, interval expressions were not traditionally available
+in 'awk'. In March of 2019, Brian Kernighan's 'awk' (finally) acquired
+them.
+
+ Nonetheless, because they were not available for so many decades,
+'gawk' continues to not supply them when in compatibility mode (*note
+Options::).
+
+ ---------- Footnotes ----------
+
+ (1) Use two backslashes if you're using a string constant with a
regexp operator or function.
@@ -33561,7 +33585,8 @@ Index
* $ (dollar sign), $ field operator <1>: Precedence. (line 42)
* $ (dollar sign), incrementing fields and arrays: Increment Ops.
(line 30)
-* $ (dollar sign), regexp operator: Regexp Operators. (line 35)
+* $ (dollar sign), regexp operator: Regexp Operator Details.
+ (line 31)
* % (percent sign), % operator: Precedence. (line 54)
* % (percent sign), %= operator: Assignment Ops. (line 129)
* % (percent sign), %= operator <1>: Precedence. (line 94)
@@ -33575,11 +33600,12 @@ Index
* ' (single quote), vs. apostrophe: Comments. (line 27)
* ' (single quote), with double quotes: Quoting. (line 73)
* () (parentheses), in a profile: Profiling. (line 146)
-* () (parentheses), regexp operator: Regexp Operators. (line 81)
+* () (parentheses), regexp operator: Regexp Operator Details.
+ (line 77)
* * (asterisk), * operator, as multiplication operator: Precedence.
(line 54)
-* * (asterisk), * operator, as regexp operator: Regexp Operators.
- (line 89)
+* * (asterisk), * operator, as regexp operator: Regexp Operator Details.
+ (line 85)
* * (asterisk), * operator, null strings, matching: String Functions.
(line 542)
* * (asterisk), ** operator: Arithmetic Ops. (line 81)
@@ -33595,7 +33621,8 @@ Index
* + (plus sign), ++ operator <2>: Precedence. (line 45)
* + (plus sign), += operator: Assignment Ops. (line 81)
* + (plus sign), += operator <1>: Precedence. (line 94)
-* + (plus sign), regexp operator: Regexp Operators. (line 105)
+* + (plus sign), regexp operator: Regexp Operator Details.
+ (line 101)
* , (comma), in range patterns: Ranges. (line 6)
* - (hyphen), - operator: Precedence. (line 51)
* - (hyphen), - operator <1>: Precedence. (line 57)
@@ -33693,7 +33720,8 @@ Index
* -V option: Options. (line 329)
* -v option <1>: Assignment Options. (line 12)
* -W option: Options. (line 51)
-* . (period), regexp operator: Regexp Operators. (line 44)
+* . (period), regexp operator: Regexp Operator Details.
+ (line 40)
* .gmo files: Explaining gettext. (line 42)
* .gmo files, specifying directory of: Explaining gettext. (line 54)
* .gmo files, specifying directory of <1>: Programmer i18n. (line 48)
@@ -33746,7 +33774,8 @@ Index
* > (right angle bracket), >> operator (I/O): Redirection. (line 50)
* > (right angle bracket), >> operator (I/O) <1>: Precedence. (line 64)
* ? (question mark), ?: operator: Precedence. (line 91)
-* ? (question mark), regexp operator: Regexp Operators. (line 111)
+* ? (question mark), regexp operator: Regexp Operator Details.
+ (line 107)
* ? (question mark), regexp operator <1>: GNU Regexp Operators.
(line 62)
* @-notation for indirect function calls: Indirect Calls. (line 47)
@@ -33757,7 +33786,8 @@ Index
(line 6)
* @namespace, no effect on BEGIN, BEGINFILE, END, and ENDFILE: Changing The
Namespace.
(line 37)
-* [] (square brackets), regexp operator: Regexp Operators. (line 56)
+* [] (square brackets), regexp operator: Regexp Operator Details.
+ (line 52)
* \ (backslash): Comments. (line 50)
* \ (backslash), as field separator: Command Line Field Separator.
(line 24)
@@ -33775,7 +33805,8 @@ Index
(line 108)
* \ (backslash), in regexp constants: Computed Regexps. (line 30)
* \ (backslash), in shell commands: Quoting. (line 48)
-* \ (backslash), regexp operator: Regexp Operators. (line 18)
+* \ (backslash), regexp operator: Regexp Operator Details.
+ (line 14)
* \ (backslash), \" escape sequence: Escape Sequences. (line 85)
* \ (backslash), \' operator (gawk): GNU Regexp Operators.
(line 59)
@@ -33810,7 +33841,8 @@ Index
* ^ (caret), in bracket expressions: Bracket Expressions. (line 25)
* ^ (caret), in FS: Regexp Field Splitting.
(line 59)
-* ^ (caret), regexp operator: Regexp Operators. (line 22)
+* ^ (caret), regexp operator: Regexp Operator Details.
+ (line 18)
* ^ (caret), regexp operator <1>: GNU Regexp Operators.
(line 62)
* ^ (caret), ^ operator: Precedence. (line 48)
@@ -33826,7 +33858,8 @@ Index
* {} (braces): Profiling. (line 142)
* {} (braces), actions and: Action Overview. (line 19)
* {} (braces), statements, grouping: Statements. (line 10)
-* | (vertical bar): Regexp Operators. (line 70)
+* | (vertical bar): Regexp Operator Details.
+ (line 66)
* | (vertical bar), | operator (I/O): Getline/Pipe. (line 10)
* | (vertical bar), | operator (I/O) <1>: Redirection. (line 57)
* | (vertical bar), | operator (I/O) <2>: Precedence. (line 64)
@@ -33986,8 +34019,8 @@ Index
* associative arrays: Array Intro. (line 48)
* asterisk (*), * operator, as multiplication operator: Precedence.
(line 54)
-* asterisk (*), * operator, as regexp operator: Regexp Operators.
- (line 89)
+* asterisk (*), * operator, as regexp operator: Regexp Operator Details.
+ (line 85)
* asterisk (*), * operator, null strings, matching: String Functions.
(line 542)
* asterisk (*), ** operator: Arithmetic Ops. (line 81)
@@ -34082,7 +34115,8 @@ Index
(line 108)
* backslash (\), in regexp constants: Computed Regexps. (line 30)
* backslash (\), in shell commands: Quoting. (line 48)
-* backslash (\), regexp operator: Regexp Operators. (line 18)
+* backslash (\), regexp operator: Regexp Operator Details.
+ (line 14)
* backslash (\), \" escape sequence: Escape Sequences. (line 85)
* backslash (\), \' operator (gawk): GNU Regexp Operators.
(line 59)
@@ -34178,7 +34212,8 @@ Index
* braces ({}): Profiling. (line 142)
* braces ({}), actions and: Action Overview. (line 19)
* braces ({}), statements, grouping: Statements. (line 10)
-* bracket expressions: Regexp Operators. (line 56)
+* bracket expressions: Regexp Operator Details.
+ (line 52)
* bracket expressions <1>: Bracket Expressions. (line 6)
* bracket expressions, character classes: Bracket Expressions.
(line 40)
@@ -34186,7 +34221,8 @@ Index
(line 90)
* bracket expressions, collating symbols: Bracket Expressions.
(line 97)
-* bracket expressions, complemented: Regexp Operators. (line 64)
+* bracket expressions, complemented: Regexp Operator Details.
+ (line 60)
* bracket expressions, equivalence classes: Bracket Expressions.
(line 103)
* bracket expressions, non-ASCII: Bracket Expressions. (line 90)
@@ -34256,7 +34292,8 @@ Index
* call stack (debugger): Debugging Terms. (line 10)
* call stack, display in debugger: Execution Stack. (line 13)
* caret (^), in bracket expressions: Bracket Expressions. (line 25)
-* caret (^), regexp operator: Regexp Operators. (line 22)
+* caret (^), regexp operator: Regexp Operator Details.
+ (line 18)
* caret (^), regexp operator <1>: GNU Regexp Operators.
(line 62)
* caret (^), ^ operator: Precedence. (line 48)
@@ -34271,16 +34308,17 @@ Index
* case sensitivity, regexps and <1>: User-modified. (line 79)
* case sensitivity, string comparisons and: User-modified. (line 79)
* CGI, awk scripts for: Options. (line 147)
-* character classes, See bracket expressions: Regexp Operators.
- (line 56)
+* character classes, See bracket expressions: Regexp Operator Details.
+ (line 52)
* character lists in regular expressions: Bracket Expressions.
(line 6)
-* character lists, See bracket expressions: Regexp Operators. (line 56)
+* character lists, See bracket expressions: Regexp Operator Details.
+ (line 52)
* character sets (machine character encodings): Ordinal Functions.
(line 45)
* character sets (machine character encodings) <1>: Glossary. (line 194)
-* character sets, See Also bracket expressions: Regexp Operators.
- (line 56)
+* character sets, See Also bracket expressions: Regexp Operator Details.
+ (line 52)
* characters, counting: Wc Program. (line 6)
* characters, transliterating: Translate Program. (line 6)
* characters, values of as numbers: Ordinal Functions. (line 6)
@@ -34773,7 +34811,8 @@ Index
* dollar sign ($), $ field operator <1>: Precedence. (line 42)
* dollar sign ($), incrementing fields and arrays: Increment Ops.
(line 30)
-* dollar sign ($), regexp operator: Regexp Operators. (line 35)
+* dollar sign ($), regexp operator: Regexp Operator Details.
+ (line 31)
* double quote ("), in regexp constants: Computed Regexps. (line 30)
* double quote ("), in shell commands: Quoting. (line 54)
* double-precision: Computer Arithmetic. (line 61)
@@ -35242,7 +35281,8 @@ Index
(line 13)
* gawk, interpreter, adding code to: Using Internal File Ops.
(line 6)
-* gawk, interval expressions and: Regexp Operators. (line 139)
+* gawk, interval expressions and: Interval Expressions.
+ (line 10)
* gawk, line continuation in: Conditional Exp. (line 34)
* gawk, LINT variable in: User-modified. (line 90)
* gawk, list of contributors to: Contributors. (line 6)
@@ -35259,7 +35299,8 @@ Index
(line 26)
* gawk, regular expressions, operators: GNU Regexp Operators.
(line 6)
-* gawk, regular expressions, precedence: Regexp Operators. (line 161)
+* gawk, regular expressions, precedence: Regexp Operator Details.
+ (line 136)
* gawk, RT variable in: awk split records. (line 131)
* gawk, RT variable in <1>: gawk split records. (line 58)
* gawk, RT variable in <2>: Multiple Line. (line 130)
@@ -35502,7 +35543,8 @@ Index
* internationalizing a program: Explaining gettext. (line 6)
* interpreted programs: Basic High Level. (line 13)
* interpreted programs <1>: Glossary. (line 443)
-* interval expressions, regexp operator: Regexp Operators. (line 116)
+* interval expressions, regexp operator: Regexp Operator Details.
+ (line 112)
* inventory-shipped file: Sample Data Files. (line 32)
* invoke shell command: I/O Functions. (line 106)
* isarray: Type Functions. (line 11)
@@ -35893,7 +35935,8 @@ Index
* Papadopoulos, Panos: Contributors. (line 131)
* parent process ID of gawk process: Auto-set. (line 251)
* parentheses (), in a profile: Profiling. (line 146)
-* parentheses (), regexp operator: Regexp Operators. (line 81)
+* parentheses (), regexp operator: Regexp Operator Details.
+ (line 77)
* password file: Passwd Functions. (line 16)
* patsplit: String Functions. (line 297)
* patterns: Patterns and Actions.
@@ -35917,7 +35960,8 @@ Index
* percent sign (%), % operator: Precedence. (line 54)
* percent sign (%), %= operator: Assignment Ops. (line 129)
* percent sign (%), %= operator <1>: Precedence. (line 94)
-* period (.), regexp operator: Regexp Operators. (line 44)
+* period (.), regexp operator: Regexp Operator Details.
+ (line 40)
* Perl: Future Extensions. (line 6)
* Peters, Arno: Contributors. (line 88)
* Peterson, Hal: Contributors. (line 40)
@@ -35937,7 +35981,8 @@ Index
* plus sign (+), ++ operator <2>: Precedence. (line 45)
* plus sign (+), += operator: Assignment Ops. (line 81)
* plus sign (+), += operator <1>: Precedence. (line 94)
-* plus sign (+), regexp operator: Regexp Operators. (line 105)
+* plus sign (+), regexp operator: Regexp Operator Details.
+ (line 101)
* pointers to functions: Indirect Calls. (line 6)
* portability: Escape Sequences. (line 103)
* portability, #! (executable scripts): Executable Scripts. (line 33)
@@ -36002,14 +36047,17 @@ Index
* POSIX awk, functions and, gsub()/sub(): Gory Details. (line 90)
* POSIX awk, functions and, length(): String Functions. (line 180)
* POSIX awk, GNU long options and: Options. (line 15)
-* POSIX awk, interval expressions in: Regexp Operators. (line 135)
+* POSIX awk, interval expressions in: Interval Expressions.
+ (line 6)
* POSIX awk, next/nextfile statements and: Next Statement. (line 44)
* POSIX awk, numeric strings and: Variable Typing. (line 67)
* POSIX awk, OFMT variable and: OFMT. (line 27)
* POSIX awk, OFMT variable and <1>: Strings And Numbers. (line 56)
-* POSIX awk, period (.), using: Regexp Operators. (line 51)
+* POSIX awk, period (.), using: Regexp Operator Details.
+ (line 47)
* POSIX awk, printf format strings and: Format Modifiers. (line 157)
-* POSIX awk, regular expressions and: Regexp Operators. (line 161)
+* POSIX awk, regular expressions and: Regexp Operator Details.
+ (line 136)
* POSIX awk, timestamps and: Time Functions. (line 6)
* POSIX awk, | I/O operator and: Getline/Pipe. (line 56)
* POSIX mode: Options. (line 282)
@@ -36021,7 +36069,8 @@ Index
* PREC variable: User-modified. (line 127)
* precedence: Increment Ops. (line 60)
* precedence <1>: Precedence. (line 6)
-* precedence, regexp operators: Regexp Operators. (line 156)
+* precedence, regexp operators: Regexp Operator Details.
+ (line 131)
* predefined variables: Built-in Variables. (line 6)
* predefined variables, -v option, setting with: Options. (line 45)
* predefined variables, conveying information: Auto-set. (line 6)
@@ -36121,7 +36170,8 @@ Index
* qualified name, use of: Qualified Names. (line 17)
* Quanstrom, Erik: Alarm Program. (line 8)
* question mark (?), ?: operator: Precedence. (line 91)
-* question mark (?), regexp operator: Regexp Operators. (line 111)
+* question mark (?), regexp operator: Regexp Operator Details.
+ (line 107)
* question mark (?), regexp operator <1>: GNU Regexp Operators.
(line 62)
* QuikTrim Awk: Other Versions. (line 143)
@@ -36195,7 +36245,8 @@ Index
* register extension: Registration Functions.
(line 6)
* regular expressions: Regexp. (line 6)
-* regular expressions, anchors in: Regexp Operators. (line 22)
+* regular expressions, anchors in: Regexp Operator Details.
+ (line 18)
* regular expressions, as field separators: Field Separators. (line 50)
* regular expressions, as field separators <1>: Regexp Field Splitting.
(line 6)
@@ -36224,8 +36275,8 @@ Index
(line 6)
* regular expressions, operators, gawk: GNU Regexp Operators.
(line 6)
-* regular expressions, operators, precedence of: Regexp Operators.
- (line 156)
+* regular expressions, operators, precedence of: Regexp Operator Details.
+ (line 131)
* regular expressions, searching for: Egrep Program. (line 6)
* relational operators, See comparison operators: Typing and Comparison.
(line 9)
@@ -36485,7 +36536,8 @@ Index
* sprintf() function, print/printf statements and: Round Function.
(line 6)
* sqrt: Numeric Functions. (line 78)
-* square brackets ([]), regexp operator: Regexp Operators. (line 56)
+* square brackets ([]), regexp operator: Regexp Operator Details.
+ (line 52)
* square root: Numeric Functions. (line 78)
* srand: Numeric Functions. (line 82)
* stack frame (debugger): Debugging Terms. (line 10)
@@ -36586,7 +36638,8 @@ Index
* Texinfo <4>: Distribution contents.
(line 83)
* Texinfo <5>: Adding Code. (line 100)
-* Texinfo, chapter beginnings in files: Regexp Operators. (line 22)
+* Texinfo, chapter beginnings in files: Regexp Operator Details.
+ (line 18)
* Texinfo, extracting programs from source files: Extract Program.
(line 6)
* text, printing: Print. (line 22)
@@ -36750,7 +36803,8 @@ Index
* version of gawk extension API: Auto-set. (line 287)
* version of GNU MP library: Auto-set. (line 270)
* version of GNU MPFR library: Auto-set. (line 272)
-* vertical bar (|): Regexp Operators. (line 70)
+* vertical bar (|): Regexp Operator Details.
+ (line 66)
* vertical bar (|), | operator (I/O): Getline/Pipe. (line 10)
* vertical bar (|), | operator (I/O) <1>: Precedence. (line 64)
* vertical bar (|), |& operator (I/O): Getline/Coprocess. (line 6)
@@ -36875,536 +36929,538 @@ Node: Regexp159037
Node: Regexp Usage160491
Node: Escape Sequences162528
Node: Regexp Operators168760
-Ref: Regexp Operators-Footnote-1176176
-Ref: Regexp Operators-Footnote-2176323
-Node: Bracket Expressions176421
-Ref: table-char-classes178897
-Node: Leftmost Longest182223
-Node: Computed Regexps183526
-Node: GNU Regexp Operators186953
-Node: Case-sensitivity190632
-Ref: Case-sensitivity-Footnote-1193519
-Ref: Case-sensitivity-Footnote-2193754
-Node: Regexp Summary193862
-Node: Reading Files195328
-Node: Records197597
-Node: awk split records198672
-Node: gawk split records203947
-Ref: gawk split records-Footnote-1208533
-Node: Fields208570
-Node: Nonconstant Fields211311
-Ref: Nonconstant Fields-Footnote-1213547
-Node: Changing Fields213751
-Node: Field Separators219782
-Node: Default Field Splitting222480
-Node: Regexp Field Splitting223598
-Node: Single Character Fields226951
-Node: Command Line Field Separator228011
-Node: Full Line Fields231229
-Ref: Full Line Fields-Footnote-1232751
-Ref: Full Line Fields-Footnote-2232797
-Node: Field Splitting Summary232898
-Node: Constant Size234972
-Node: Fixed width data235704
-Node: Skipping intervening239171
-Node: Allowing trailing data239969
-Node: Fields with fixed data241006
-Node: Splitting By Content242524
-Ref: Splitting By Content-Footnote-1246174
-Node: Testing field creation246337
-Node: Multiple Line247962
-Ref: Multiple Line-Footnote-1253846
-Node: Getline254025
-Node: Plain Getline256494
-Node: Getline/Variable259135
-Node: Getline/File260286
-Node: Getline/Variable/File261674
-Ref: Getline/Variable/File-Footnote-1263279
-Node: Getline/Pipe263367
-Node: Getline/Variable/Pipe266074
-Node: Getline/Coprocess267209
-Node: Getline/Variable/Coprocess268476
-Node: Getline Notes269218
-Node: Getline Summary272015
-Ref: table-getline-variants272439
-Node: Read Timeout273187
-Ref: Read Timeout-Footnote-1277093
-Node: Retrying Input277151
-Node: Command-line directories278350
-Node: Input Summary279256
-Node: Input Exercises282428
-Node: Printing283156
-Node: Print284990
-Node: Print Examples286447
-Node: Output Separators289227
-Node: OFMT291244
-Node: Printf292600
-Node: Basic Printf293385
-Node: Control Letters294959
-Node: Format Modifiers300123
-Node: Printf Examples306138
-Node: Redirection308624
-Node: Special FD315465
-Ref: Special FD-Footnote-1318633
-Node: Special Files318707
-Node: Other Inherited Files319324
-Node: Special Network320325
-Node: Special Caveats321185
-Node: Close Files And Pipes322134
-Ref: table-close-pipe-return-values329041
-Ref: Close Files And Pipes-Footnote-1329854
-Ref: Close Files And Pipes-Footnote-2330002
-Node: Nonfatal330154
-Node: Output Summary332492
-Node: Output Exercises333714
-Node: Expressions334393
-Node: Values335581
-Node: Constants336259
-Node: Scalar Constants336950
-Ref: Scalar Constants-Footnote-1339474
-Node: Nondecimal-numbers339724
-Node: Regexp Constants342725
-Node: Using Constant Regexps343251
-Node: Standard Regexp Constants343873
-Node: Strong Regexp Constants347061
-Node: Variables350019
-Node: Using Variables350676
-Node: Assignment Options352586
-Node: Conversion355053
-Node: Strings And Numbers355577
-Ref: Strings And Numbers-Footnote-1358640
-Node: Locale influences conversions358749
-Ref: table-locale-affects361507
-Node: All Operators362125
-Node: Arithmetic Ops362754
-Node: Concatenation365260
-Ref: Concatenation-Footnote-1368107
-Node: Assignment Ops368214
-Ref: table-assign-ops373205
-Node: Increment Ops374518
-Node: Truth Values and Conditions377978
-Node: Truth Values379052
-Node: Typing and Comparison380100
-Node: Variable Typing380920
-Ref: Variable Typing-Footnote-1387383
-Ref: Variable Typing-Footnote-2387455
-Node: Comparison Operators387532
-Ref: table-relational-ops387951
-Node: POSIX String Comparison391446
-Ref: POSIX String Comparison-Footnote-1393141
-Ref: POSIX String Comparison-Footnote-2393280
-Node: Boolean Ops393364
-Ref: Boolean Ops-Footnote-1397846
-Node: Conditional Exp397938
-Node: Function Calls399674
-Node: Precedence403551
-Node: Locales407210
-Node: Expressions Summary408842
-Node: Patterns and Actions411415
-Node: Pattern Overview412535
-Node: Regexp Patterns414212
-Node: Expression Patterns414754
-Node: Ranges418535
-Node: BEGIN/END421643
-Node: Using BEGIN/END422404
-Ref: Using BEGIN/END-Footnote-1425140
-Node: I/O And BEGIN/END425246
-Node: BEGINFILE/ENDFILE427560
-Node: Empty430473
-Node: Using Shell Variables430790
-Node: Action Overview433064
-Node: Statements435389
-Node: If Statement437237
-Node: While Statement438732
-Node: Do Statement440760
-Node: For Statement441908
-Node: Switch Statement445079
-Node: Break Statement447465
-Node: Continue Statement449557
-Node: Next Statement451384
-Node: Nextfile Statement453767
-Node: Exit Statement456419
-Node: Built-in Variables458822
-Node: User-modified459955
-Node: Auto-set467722
-Ref: Auto-set-Footnote-1484529
-Ref: Auto-set-Footnote-2484735
-Node: ARGC and ARGV484791
-Node: Pattern Action Summary489004
-Node: Arrays491434
-Node: Array Basics492763
-Node: Array Intro493607
-Ref: figure-array-elements495582
-Ref: Array Intro-Footnote-1498286
-Node: Reference to Elements498414
-Node: Assigning Elements500878
-Node: Array Example501369
-Node: Scanning an Array503128
-Node: Controlling Scanning506150
-Ref: Controlling Scanning-Footnote-1511549
-Node: Numeric Array Subscripts511865
-Node: Uninitialized Subscripts514049
-Node: Delete515668
-Ref: Delete-Footnote-1518420
-Node: Multidimensional518477
-Node: Multiscanning521572
-Node: Arrays of Arrays523163
-Node: Arrays Summary527931
-Node: Functions530024
-Node: Built-in531062
-Node: Calling Built-in532143
-Node: Numeric Functions534139
-Ref: Numeric Functions-Footnote-1538167
-Ref: Numeric Functions-Footnote-2538812
-Ref: Numeric Functions-Footnote-3538860
-Node: String Functions539132
-Ref: String Functions-Footnote-1562990
-Ref: String Functions-Footnote-2563118
-Ref: String Functions-Footnote-3563366
-Node: Gory Details563453
-Ref: table-sub-escapes565244
-Ref: table-sub-proposed566763
-Ref: table-posix-sub568126
-Ref: table-gensub-escapes569667
-Ref: Gory Details-Footnote-1570490
-Node: I/O Functions570644
-Ref: table-system-return-values577112
-Ref: I/O Functions-Footnote-1579192
-Ref: I/O Functions-Footnote-2579340
-Node: Time Functions579460
-Ref: Time Functions-Footnote-1590131
-Ref: Time Functions-Footnote-2590199
-Ref: Time Functions-Footnote-3590357
-Ref: Time Functions-Footnote-4590468
-Ref: Time Functions-Footnote-5590580
-Ref: Time Functions-Footnote-6590807
-Node: Bitwise Functions591073
-Ref: table-bitwise-ops591667
-Ref: Bitwise Functions-Footnote-1597730
-Ref: Bitwise Functions-Footnote-2597903
-Node: Type Functions598094
-Node: I18N Functions600845
-Node: User-defined602496
-Node: Definition Syntax603308
-Ref: Definition Syntax-Footnote-1608995
-Node: Function Example609066
-Ref: Function Example-Footnote-1611988
-Node: Function Calling612010
-Node: Calling A Function612598
-Node: Variable Scope613556
-Node: Pass By Value/Reference616550
-Node: Function Caveats619194
-Ref: Function Caveats-Footnote-1621241
-Node: Return Statement621361
-Node: Dynamic Typing624340
-Node: Indirect Calls625270
-Ref: Indirect Calls-Footnote-1635522
-Node: Functions Summary635650
-Node: Library Functions638355
-Ref: Library Functions-Footnote-1641962
-Ref: Library Functions-Footnote-2642105
-Node: Library Names642276
-Ref: Library Names-Footnote-1645943
-Ref: Library Names-Footnote-2646166
-Node: General Functions646252
-Node: Strtonum Function647355
-Node: Assert Function650377
-Node: Round Function653703
-Node: Cliff Random Function655243
-Node: Ordinal Functions656259
-Ref: Ordinal Functions-Footnote-1659322
-Ref: Ordinal Functions-Footnote-2659574
-Node: Join Function659784
-Ref: Join Function-Footnote-1661554
-Node: Getlocaltime Function661754
-Node: Readfile Function665496
-Node: Shell Quoting667473
-Node: Data File Management668874
-Node: Filetrans Function669506
-Node: Rewind Function673602
-Node: File Checking675511
-Ref: File Checking-Footnote-1676845
-Node: Empty Files677046
-Node: Ignoring Assigns679025
-Node: Getopt Function680575
-Ref: Getopt Function-Footnote-1692044
-Node: Passwd Functions692244
-Ref: Passwd Functions-Footnote-1701083
-Node: Group Functions701171
-Ref: Group Functions-Footnote-1709069
-Node: Walking Arrays709276
-Node: Library Functions Summary712284
-Node: Library Exercises713690
-Node: Sample Programs714155
-Node: Running Examples714925
-Node: Clones715653
-Node: Cut Program716877
-Node: Egrep Program726806
-Ref: Egrep Program-Footnote-1734318
-Node: Id Program734428
-Node: Split Program738108
-Ref: Split Program-Footnote-1741566
-Node: Tee Program741695
-Node: Uniq Program744485
-Node: Wc Program752106
-Ref: Wc Program-Footnote-1756361
-Node: Miscellaneous Programs756455
-Node: Dupword Program757668
-Node: Alarm Program759698
-Node: Translate Program764553
-Ref: Translate Program-Footnote-1769118
-Node: Labels Program769388
-Ref: Labels Program-Footnote-1772739
-Node: Word Sorting772823
-Node: History Sorting776895
-Node: Extract Program778730
-Node: Simple Sed786784
-Node: Igawk Program789858
-Ref: Igawk Program-Footnote-1804189
-Ref: Igawk Program-Footnote-2804391
-Ref: Igawk Program-Footnote-3804513
-Node: Anagram Program804628
-Node: Signature Program807690
-Node: Programs Summary808937
-Node: Programs Exercises810151
-Ref: Programs Exercises-Footnote-1814280
-Node: Advanced Features814371
-Node: Nondecimal Data816361
-Node: Array Sorting817952
-Node: Controlling Array Traversal818652
-Ref: Controlling Array Traversal-Footnote-1827020
-Node: Array Sorting Functions827138
-Ref: Array Sorting Functions-Footnote-1832229
-Node: Two-way I/O832425
-Ref: Two-way I/O-Footnote-1840146
-Ref: Two-way I/O-Footnote-2840333
-Node: TCP/IP Networking840415
-Node: Profiling843533
-Node: Advanced Features Summary852551
-Node: Internationalization854395
-Node: I18N and L10N855875
-Node: Explaining gettext856562
-Ref: Explaining gettext-Footnote-1862454
-Ref: Explaining gettext-Footnote-2862639
-Node: Programmer i18n862804
-Ref: Programmer i18n-Footnote-1867753
-Node: Translator i18n867802
-Node: String Extraction868596
-Ref: String Extraction-Footnote-1869728
-Node: Printf Ordering869814
-Ref: Printf Ordering-Footnote-1872600
-Node: I18N Portability872664
-Ref: I18N Portability-Footnote-1875120
-Node: I18N Example875183
-Ref: I18N Example-Footnote-1878458
-Ref: I18N Example-Footnote-2878531
-Node: Gawk I18N878640
-Node: I18N Summary879285
-Node: Debugger880626
-Node: Debugging881626
-Node: Debugging Concepts882067
-Node: Debugging Terms883876
-Node: Awk Debugging886451
-Ref: Awk Debugging-Footnote-1887396
-Node: Sample Debugging Session887528
-Node: Debugger Invocation888062
-Node: Finding The Bug889448
-Node: List of Debugger Commands895922
-Node: Breakpoint Control897255
-Node: Debugger Execution Control900949
-Node: Viewing And Changing Data904311
-Node: Execution Stack907852
-Node: Debugger Info909489
-Node: Miscellaneous Debugger Commands913560
-Node: Readline Support918622
-Node: Limitations919518
-Node: Debugging Summary921627
-Node: Namespaces922906
-Node: Global Namespace923985
-Node: Qualified Names925383
-Node: Default Namespace926382
-Node: Changing The Namespace927123
-Node: Naming Rules928737
-Node: Internal Name Management930585
-Node: Namespace Example931627
-Node: Namespace And Features934189
-Node: Namespace Summary935624
-Node: Arbitrary Precision Arithmetic937101
-Node: Computer Arithmetic938588
-Ref: table-numeric-ranges942354
-Ref: table-floating-point-ranges942847
-Ref: Computer Arithmetic-Footnote-1943505
-Node: Math Definitions943562
-Ref: table-ieee-formats946878
-Ref: Math Definitions-Footnote-1947481
-Node: MPFR features947586
-Node: FP Math Caution949304
-Ref: FP Math Caution-Footnote-1950376
-Node: Inexactness of computations950745
-Node: Inexact representation951705
-Node: Comparing FP Values953065
-Node: Errors accumulate954306
-Node: Getting Accuracy955739
-Node: Try To Round958449
-Node: Setting precision959348
-Ref: table-predefined-precision-strings960045
-Node: Setting the rounding mode961875
-Ref: table-gawk-rounding-modes962249
-Ref: Setting the rounding mode-Footnote-1966180
-Node: Arbitrary Precision Integers966359
-Ref: Arbitrary Precision Integers-Footnote-1969534
-Node: Checking for MPFR969683
-Node: POSIX Floating Point Problems971157
-Ref: POSIX Floating Point Problems-Footnote-1975442
-Node: Floating point summary975480
-Node: Dynamic Extensions977670
-Node: Extension Intro979223
-Node: Plugin License980489
-Node: Extension Mechanism Outline981286
-Ref: figure-load-extension981725
-Ref: figure-register-new-function983290
-Ref: figure-call-new-function984382
-Node: Extension API Description986444
-Node: Extension API Functions Introduction988086
-Ref: table-api-std-headers989922
-Node: General Data Types993787
-Ref: General Data Types-Footnote-11002148
-Node: Memory Allocation Functions1002447
-Ref: Memory Allocation Functions-Footnote-11006657
-Node: Constructor Functions1006756
-Node: Registration Functions1010342
-Node: Extension Functions1011027
-Node: Exit Callback Functions1016349
-Node: Extension Version String1017599
-Node: Input Parsers1018262
-Node: Output Wrappers1030983
-Node: Two-way processors1035495
-Node: Printing Messages1037760
-Ref: Printing Messages-Footnote-11038931
-Node: Updating ERRNO1039084
-Node: Requesting Values1039823
-Ref: table-value-types-returned1040560
-Node: Accessing Parameters1041496
-Node: Symbol Table Access1042731
-Node: Symbol table by name1043243
-Ref: Symbol table by name-Footnote-11046267
-Node: Symbol table by cookie1046395
-Ref: Symbol table by cookie-Footnote-11050580
-Node: Cached values1050644
-Ref: Cached values-Footnote-11054180
-Node: Array Manipulation1054333
-Ref: Array Manipulation-Footnote-11055424
-Node: Array Data Types1055461
-Ref: Array Data Types-Footnote-11058119
-Node: Array Functions1058211
-Node: Flattening Arrays1062709
-Node: Creating Arrays1069685
-Node: Redirection API1074452
-Node: Extension API Variables1077285
-Node: Extension Versioning1077996
-Ref: gawk-api-version1078425
-Node: Extension GMP/MPFR Versioning1080156
-Node: Extension API Informational Variables1081784
-Node: Extension API Boilerplate1082857
-Node: Changes from API V11086831
-Node: Finding Extensions1088403
-Node: Extension Example1088962
-Node: Internal File Description1089760
-Node: Internal File Ops1093840
-Ref: Internal File Ops-Footnote-11105190
-Node: Using Internal File Ops1105330
-Ref: Using Internal File Ops-Footnote-11107713
-Node: Extension Samples1107987
-Node: Extension Sample File Functions1109516
-Node: Extension Sample Fnmatch1117165
-Node: Extension Sample Fork1118652
-Node: Extension Sample Inplace1119870
-Node: Extension Sample Ord1123174
-Node: Extension Sample Readdir1124010
-Ref: table-readdir-file-types1124899
-Node: Extension Sample Revout1125704
-Node: Extension Sample Rev2way1126293
-Node: Extension Sample Read write array1127033
-Node: Extension Sample Readfile1128975
-Node: Extension Sample Time1130070
-Node: Extension Sample API Tests1131418
-Node: gawkextlib1131910
-Node: Extension summary1134828
-Node: Extension Exercises1138530
-Node: Language History1139772
-Node: V7/SVR3.11141428
-Node: SVR41143580
-Node: POSIX1145014
-Node: BTL1146394
-Node: POSIX/GNU1147123
-Node: Feature History1152901
-Node: Common Extensions1168947
-Node: Ranges and Locales1170230
-Ref: Ranges and Locales-Footnote-11174846
-Ref: Ranges and Locales-Footnote-21174873
-Ref: Ranges and Locales-Footnote-31175108
-Node: Contributors1175329
-Node: History summary1181274
-Node: Installation1182654
-Node: Gawk Distribution1183598
-Node: Getting1184082
-Node: Extracting1185045
-Node: Distribution contents1186683
-Node: Unix Installation1193163
-Node: Quick Installation1193845
-Node: Shell Startup Files1196259
-Node: Additional Configuration Options1197348
-Node: Configuration Philosophy1199513
-Node: Non-Unix Installation1201882
-Node: PC Installation1202342
-Node: PC Binary Installation1203180
-Node: PC Compiling1203615
-Node: PC Using1204732
-Node: Cygwin1208285
-Node: MSYS1209384
-Node: VMS Installation1209885
-Node: VMS Compilation1210676
-Ref: VMS Compilation-Footnote-11211905
-Node: VMS Dynamic Extensions1211963
-Node: VMS Installation Details1213648
-Node: VMS Running1215901
-Node: VMS GNV1220180
-Node: VMS Old Gawk1220915
-Node: Bugs1221386
-Node: Bug address1222049
-Node: Usenet1225031
-Node: Maintainers1226035
-Node: Other Versions1227296
-Node: Installation summary1234210
-Node: Notes1235412
-Node: Compatibility Mode1236206
-Node: Additions1236988
-Node: Accessing The Source1237913
-Node: Adding Code1239350
-Node: New Ports1245569
-Node: Derived Files1250057
-Ref: Derived Files-Footnote-11255703
-Ref: Derived Files-Footnote-21255738
-Ref: Derived Files-Footnote-31256336
-Node: Future Extensions1256450
-Node: Implementation Limitations1257108
-Node: Extension Design1258291
-Node: Old Extension Problems1259435
-Ref: Old Extension Problems-Footnote-11260953
-Node: Extension New Mechanism Goals1261010
-Ref: Extension New Mechanism Goals-Footnote-11264374
-Node: Extension Other Design Decisions1264563
-Node: Extension Future Growth1266676
-Node: Notes summary1267512
-Node: Basic Concepts1268687
-Node: Basic High Level1269368
-Ref: figure-general-flow1269650
-Ref: figure-process-flow1270335
-Ref: Basic High Level-Footnote-11273636
-Node: Basic Data Typing1273821
-Node: Glossary1277149
-Node: Copying1308987
-Node: GNU Free Documentation License1346530
-Node: Index1371650
+Node: Regexp Operator Details169245
+Ref: Regexp Operator Details-Footnote-1175367
+Node: Interval Expressions175514
+Ref: Interval Expressions-Footnote-1176949
+Node: Bracket Expressions177047
+Ref: table-char-classes179523
+Node: Leftmost Longest182849
+Node: Computed Regexps184152
+Node: GNU Regexp Operators187579
+Node: Case-sensitivity191258
+Ref: Case-sensitivity-Footnote-1194145
+Ref: Case-sensitivity-Footnote-2194380
+Node: Regexp Summary194488
+Node: Reading Files195954
+Node: Records198223
+Node: awk split records199298
+Node: gawk split records204573
+Ref: gawk split records-Footnote-1209159
+Node: Fields209196
+Node: Nonconstant Fields211937
+Ref: Nonconstant Fields-Footnote-1214173
+Node: Changing Fields214377
+Node: Field Separators220408
+Node: Default Field Splitting223106
+Node: Regexp Field Splitting224224
+Node: Single Character Fields227577
+Node: Command Line Field Separator228637
+Node: Full Line Fields231855
+Ref: Full Line Fields-Footnote-1233377
+Ref: Full Line Fields-Footnote-2233423
+Node: Field Splitting Summary233524
+Node: Constant Size235598
+Node: Fixed width data236330
+Node: Skipping intervening239797
+Node: Allowing trailing data240595
+Node: Fields with fixed data241632
+Node: Splitting By Content243150
+Ref: Splitting By Content-Footnote-1246800
+Node: Testing field creation246963
+Node: Multiple Line248588
+Ref: Multiple Line-Footnote-1254472
+Node: Getline254651
+Node: Plain Getline257120
+Node: Getline/Variable259761
+Node: Getline/File260912
+Node: Getline/Variable/File262300
+Ref: Getline/Variable/File-Footnote-1263905
+Node: Getline/Pipe263993
+Node: Getline/Variable/Pipe266700
+Node: Getline/Coprocess267835
+Node: Getline/Variable/Coprocess269102
+Node: Getline Notes269844
+Node: Getline Summary272641
+Ref: table-getline-variants273065
+Node: Read Timeout273813
+Ref: Read Timeout-Footnote-1277719
+Node: Retrying Input277777
+Node: Command-line directories278976
+Node: Input Summary279882
+Node: Input Exercises283054
+Node: Printing283782
+Node: Print285616
+Node: Print Examples287073
+Node: Output Separators289853
+Node: OFMT291870
+Node: Printf293226
+Node: Basic Printf294011
+Node: Control Letters295585
+Node: Format Modifiers300749
+Node: Printf Examples306764
+Node: Redirection309250
+Node: Special FD316091
+Ref: Special FD-Footnote-1319259
+Node: Special Files319333
+Node: Other Inherited Files319950
+Node: Special Network320951
+Node: Special Caveats321811
+Node: Close Files And Pipes322760
+Ref: table-close-pipe-return-values329667
+Ref: Close Files And Pipes-Footnote-1330480
+Ref: Close Files And Pipes-Footnote-2330628
+Node: Nonfatal330780
+Node: Output Summary333118
+Node: Output Exercises334340
+Node: Expressions335019
+Node: Values336207
+Node: Constants336885
+Node: Scalar Constants337576
+Ref: Scalar Constants-Footnote-1340100
+Node: Nondecimal-numbers340350
+Node: Regexp Constants343351
+Node: Using Constant Regexps343877
+Node: Standard Regexp Constants344499
+Node: Strong Regexp Constants347687
+Node: Variables350645
+Node: Using Variables351302
+Node: Assignment Options353212
+Node: Conversion355679
+Node: Strings And Numbers356203
+Ref: Strings And Numbers-Footnote-1359266
+Node: Locale influences conversions359375
+Ref: table-locale-affects362133
+Node: All Operators362751
+Node: Arithmetic Ops363380
+Node: Concatenation365886
+Ref: Concatenation-Footnote-1368733
+Node: Assignment Ops368840
+Ref: table-assign-ops373831
+Node: Increment Ops375144
+Node: Truth Values and Conditions378604
+Node: Truth Values379678
+Node: Typing and Comparison380726
+Node: Variable Typing381546
+Ref: Variable Typing-Footnote-1388009
+Ref: Variable Typing-Footnote-2388081
+Node: Comparison Operators388158
+Ref: table-relational-ops388577
+Node: POSIX String Comparison392072
+Ref: POSIX String Comparison-Footnote-1393767
+Ref: POSIX String Comparison-Footnote-2393906
+Node: Boolean Ops393990
+Ref: Boolean Ops-Footnote-1398472
+Node: Conditional Exp398564
+Node: Function Calls400300
+Node: Precedence404177
+Node: Locales407836
+Node: Expressions Summary409468
+Node: Patterns and Actions412041
+Node: Pattern Overview413161
+Node: Regexp Patterns414838
+Node: Expression Patterns415380
+Node: Ranges419161
+Node: BEGIN/END422269
+Node: Using BEGIN/END423030
+Ref: Using BEGIN/END-Footnote-1425766
+Node: I/O And BEGIN/END425872
+Node: BEGINFILE/ENDFILE428186
+Node: Empty431099
+Node: Using Shell Variables431416
+Node: Action Overview433690
+Node: Statements436015
+Node: If Statement437863
+Node: While Statement439358
+Node: Do Statement441386
+Node: For Statement442534
+Node: Switch Statement445705
+Node: Break Statement448091
+Node: Continue Statement450183
+Node: Next Statement452010
+Node: Nextfile Statement454393
+Node: Exit Statement457045
+Node: Built-in Variables459448
+Node: User-modified460581
+Node: Auto-set468348
+Ref: Auto-set-Footnote-1485155
+Ref: Auto-set-Footnote-2485361
+Node: ARGC and ARGV485417
+Node: Pattern Action Summary489630
+Node: Arrays492060
+Node: Array Basics493389
+Node: Array Intro494233
+Ref: figure-array-elements496208
+Ref: Array Intro-Footnote-1498912
+Node: Reference to Elements499040
+Node: Assigning Elements501504
+Node: Array Example501995
+Node: Scanning an Array503754
+Node: Controlling Scanning506776
+Ref: Controlling Scanning-Footnote-1512175
+Node: Numeric Array Subscripts512491
+Node: Uninitialized Subscripts514675
+Node: Delete516294
+Ref: Delete-Footnote-1519046
+Node: Multidimensional519103
+Node: Multiscanning522198
+Node: Arrays of Arrays523789
+Node: Arrays Summary528557
+Node: Functions530650
+Node: Built-in531688
+Node: Calling Built-in532769
+Node: Numeric Functions534765
+Ref: Numeric Functions-Footnote-1538793
+Ref: Numeric Functions-Footnote-2539438
+Ref: Numeric Functions-Footnote-3539486
+Node: String Functions539758
+Ref: String Functions-Footnote-1563616
+Ref: String Functions-Footnote-2563744
+Ref: String Functions-Footnote-3563992
+Node: Gory Details564079
+Ref: table-sub-escapes565870
+Ref: table-sub-proposed567389
+Ref: table-posix-sub568752
+Ref: table-gensub-escapes570293
+Ref: Gory Details-Footnote-1571116
+Node: I/O Functions571270
+Ref: table-system-return-values577738
+Ref: I/O Functions-Footnote-1579818
+Ref: I/O Functions-Footnote-2579966
+Node: Time Functions580086
+Ref: Time Functions-Footnote-1590757
+Ref: Time Functions-Footnote-2590825
+Ref: Time Functions-Footnote-3590983
+Ref: Time Functions-Footnote-4591094
+Ref: Time Functions-Footnote-5591206
+Ref: Time Functions-Footnote-6591433
+Node: Bitwise Functions591699
+Ref: table-bitwise-ops592293
+Ref: Bitwise Functions-Footnote-1598356
+Ref: Bitwise Functions-Footnote-2598529
+Node: Type Functions598720
+Node: I18N Functions601471
+Node: User-defined603122
+Node: Definition Syntax603934
+Ref: Definition Syntax-Footnote-1609621
+Node: Function Example609692
+Ref: Function Example-Footnote-1612614
+Node: Function Calling612636
+Node: Calling A Function613224
+Node: Variable Scope614182
+Node: Pass By Value/Reference617176
+Node: Function Caveats619820
+Ref: Function Caveats-Footnote-1621867
+Node: Return Statement621987
+Node: Dynamic Typing624966
+Node: Indirect Calls625896
+Ref: Indirect Calls-Footnote-1636148
+Node: Functions Summary636276
+Node: Library Functions638981
+Ref: Library Functions-Footnote-1642588
+Ref: Library Functions-Footnote-2642731
+Node: Library Names642902
+Ref: Library Names-Footnote-1646569
+Ref: Library Names-Footnote-2646792
+Node: General Functions646878
+Node: Strtonum Function647981
+Node: Assert Function651003
+Node: Round Function654329
+Node: Cliff Random Function655869
+Node: Ordinal Functions656885
+Ref: Ordinal Functions-Footnote-1659948
+Ref: Ordinal Functions-Footnote-2660200
+Node: Join Function660410
+Ref: Join Function-Footnote-1662180
+Node: Getlocaltime Function662380
+Node: Readfile Function666122
+Node: Shell Quoting668099
+Node: Data File Management669500
+Node: Filetrans Function670132
+Node: Rewind Function674228
+Node: File Checking676137
+Ref: File Checking-Footnote-1677471
+Node: Empty Files677672
+Node: Ignoring Assigns679651
+Node: Getopt Function681201
+Ref: Getopt Function-Footnote-1692670
+Node: Passwd Functions692870
+Ref: Passwd Functions-Footnote-1701709
+Node: Group Functions701797
+Ref: Group Functions-Footnote-1709695
+Node: Walking Arrays709902
+Node: Library Functions Summary712910
+Node: Library Exercises714316
+Node: Sample Programs714781
+Node: Running Examples715551
+Node: Clones716279
+Node: Cut Program717503
+Node: Egrep Program727432
+Ref: Egrep Program-Footnote-1734944
+Node: Id Program735054
+Node: Split Program738734
+Ref: Split Program-Footnote-1742192
+Node: Tee Program742321
+Node: Uniq Program745111
+Node: Wc Program752732
+Ref: Wc Program-Footnote-1756987
+Node: Miscellaneous Programs757081
+Node: Dupword Program758294
+Node: Alarm Program760324
+Node: Translate Program765179
+Ref: Translate Program-Footnote-1769744
+Node: Labels Program770014
+Ref: Labels Program-Footnote-1773365
+Node: Word Sorting773449
+Node: History Sorting777521
+Node: Extract Program779356
+Node: Simple Sed787410
+Node: Igawk Program790484
+Ref: Igawk Program-Footnote-1804815
+Ref: Igawk Program-Footnote-2805017
+Ref: Igawk Program-Footnote-3805139
+Node: Anagram Program805254
+Node: Signature Program808316
+Node: Programs Summary809563
+Node: Programs Exercises810777
+Ref: Programs Exercises-Footnote-1814906
+Node: Advanced Features814997
+Node: Nondecimal Data816987
+Node: Array Sorting818578
+Node: Controlling Array Traversal819278
+Ref: Controlling Array Traversal-Footnote-1827646
+Node: Array Sorting Functions827764
+Ref: Array Sorting Functions-Footnote-1832855
+Node: Two-way I/O833051
+Ref: Two-way I/O-Footnote-1840772
+Ref: Two-way I/O-Footnote-2840959
+Node: TCP/IP Networking841041
+Node: Profiling844159
+Node: Advanced Features Summary853177
+Node: Internationalization855021
+Node: I18N and L10N856501
+Node: Explaining gettext857188
+Ref: Explaining gettext-Footnote-1863080
+Ref: Explaining gettext-Footnote-2863265
+Node: Programmer i18n863430
+Ref: Programmer i18n-Footnote-1868379
+Node: Translator i18n868428
+Node: String Extraction869222
+Ref: String Extraction-Footnote-1870354
+Node: Printf Ordering870440
+Ref: Printf Ordering-Footnote-1873226
+Node: I18N Portability873290
+Ref: I18N Portability-Footnote-1875746
+Node: I18N Example875809
+Ref: I18N Example-Footnote-1879084
+Ref: I18N Example-Footnote-2879157
+Node: Gawk I18N879266
+Node: I18N Summary879911
+Node: Debugger881252
+Node: Debugging882252
+Node: Debugging Concepts882693
+Node: Debugging Terms884502
+Node: Awk Debugging887077
+Ref: Awk Debugging-Footnote-1888022
+Node: Sample Debugging Session888154
+Node: Debugger Invocation888688
+Node: Finding The Bug890074
+Node: List of Debugger Commands896548
+Node: Breakpoint Control897881
+Node: Debugger Execution Control901575
+Node: Viewing And Changing Data904937
+Node: Execution Stack908478
+Node: Debugger Info910115
+Node: Miscellaneous Debugger Commands914186
+Node: Readline Support919248
+Node: Limitations920144
+Node: Debugging Summary922253
+Node: Namespaces923532
+Node: Global Namespace924611
+Node: Qualified Names926009
+Node: Default Namespace927008
+Node: Changing The Namespace927749
+Node: Naming Rules929363
+Node: Internal Name Management931211
+Node: Namespace Example932253
+Node: Namespace And Features934815
+Node: Namespace Summary936250
+Node: Arbitrary Precision Arithmetic937727
+Node: Computer Arithmetic939214
+Ref: table-numeric-ranges942980
+Ref: table-floating-point-ranges943473
+Ref: Computer Arithmetic-Footnote-1944131
+Node: Math Definitions944188
+Ref: table-ieee-formats947504
+Ref: Math Definitions-Footnote-1948107
+Node: MPFR features948212
+Node: FP Math Caution949930
+Ref: FP Math Caution-Footnote-1951002
+Node: Inexactness of computations951371
+Node: Inexact representation952331
+Node: Comparing FP Values953691
+Node: Errors accumulate954932
+Node: Getting Accuracy956365
+Node: Try To Round959075
+Node: Setting precision959974
+Ref: table-predefined-precision-strings960671
+Node: Setting the rounding mode962501
+Ref: table-gawk-rounding-modes962875
+Ref: Setting the rounding mode-Footnote-1966806
+Node: Arbitrary Precision Integers966985
+Ref: Arbitrary Precision Integers-Footnote-1970160
+Node: Checking for MPFR970309
+Node: POSIX Floating Point Problems971783
+Ref: POSIX Floating Point Problems-Footnote-1976068
+Node: Floating point summary976106
+Node: Dynamic Extensions978296
+Node: Extension Intro979849
+Node: Plugin License981115
+Node: Extension Mechanism Outline981912
+Ref: figure-load-extension982351
+Ref: figure-register-new-function983916
+Ref: figure-call-new-function985008
+Node: Extension API Description987070
+Node: Extension API Functions Introduction988712
+Ref: table-api-std-headers990548
+Node: General Data Types994413
+Ref: General Data Types-Footnote-11002774
+Node: Memory Allocation Functions1003073
+Ref: Memory Allocation Functions-Footnote-11007283
+Node: Constructor Functions1007382
+Node: Registration Functions1010968
+Node: Extension Functions1011653
+Node: Exit Callback Functions1016975
+Node: Extension Version String1018225
+Node: Input Parsers1018888
+Node: Output Wrappers1031609
+Node: Two-way processors1036121
+Node: Printing Messages1038386
+Ref: Printing Messages-Footnote-11039557
+Node: Updating ERRNO1039710
+Node: Requesting Values1040449
+Ref: table-value-types-returned1041186
+Node: Accessing Parameters1042122
+Node: Symbol Table Access1043357
+Node: Symbol table by name1043869
+Ref: Symbol table by name-Footnote-11046893
+Node: Symbol table by cookie1047021
+Ref: Symbol table by cookie-Footnote-11051206
+Node: Cached values1051270
+Ref: Cached values-Footnote-11054806
+Node: Array Manipulation1054959
+Ref: Array Manipulation-Footnote-11056050
+Node: Array Data Types1056087
+Ref: Array Data Types-Footnote-11058745
+Node: Array Functions1058837
+Node: Flattening Arrays1063335
+Node: Creating Arrays1070311
+Node: Redirection API1075078
+Node: Extension API Variables1077911
+Node: Extension Versioning1078622
+Ref: gawk-api-version1079051
+Node: Extension GMP/MPFR Versioning1080782
+Node: Extension API Informational Variables1082410
+Node: Extension API Boilerplate1083483
+Node: Changes from API V11087457
+Node: Finding Extensions1089029
+Node: Extension Example1089588
+Node: Internal File Description1090386
+Node: Internal File Ops1094466
+Ref: Internal File Ops-Footnote-11105816
+Node: Using Internal File Ops1105956
+Ref: Using Internal File Ops-Footnote-11108339
+Node: Extension Samples1108613
+Node: Extension Sample File Functions1110142
+Node: Extension Sample Fnmatch1117791
+Node: Extension Sample Fork1119278
+Node: Extension Sample Inplace1120496
+Node: Extension Sample Ord1123800
+Node: Extension Sample Readdir1124636
+Ref: table-readdir-file-types1125525
+Node: Extension Sample Revout1126330
+Node: Extension Sample Rev2way1126919
+Node: Extension Sample Read write array1127659
+Node: Extension Sample Readfile1129601
+Node: Extension Sample Time1130696
+Node: Extension Sample API Tests1132044
+Node: gawkextlib1132536
+Node: Extension summary1135454
+Node: Extension Exercises1139156
+Node: Language History1140398
+Node: V7/SVR3.11142054
+Node: SVR41144206
+Node: POSIX1145640
+Node: BTL1147020
+Node: POSIX/GNU1147749
+Node: Feature History1153527
+Node: Common Extensions1169573
+Node: Ranges and Locales1170856
+Ref: Ranges and Locales-Footnote-11175472
+Ref: Ranges and Locales-Footnote-21175499
+Ref: Ranges and Locales-Footnote-31175734
+Node: Contributors1175955
+Node: History summary1181900
+Node: Installation1183280
+Node: Gawk Distribution1184224
+Node: Getting1184708
+Node: Extracting1185671
+Node: Distribution contents1187309
+Node: Unix Installation1193789
+Node: Quick Installation1194471
+Node: Shell Startup Files1196885
+Node: Additional Configuration Options1197974
+Node: Configuration Philosophy1200139
+Node: Non-Unix Installation1202508
+Node: PC Installation1202968
+Node: PC Binary Installation1203806
+Node: PC Compiling1204241
+Node: PC Using1205358
+Node: Cygwin1208911
+Node: MSYS1210010
+Node: VMS Installation1210511
+Node: VMS Compilation1211302
+Ref: VMS Compilation-Footnote-11212531
+Node: VMS Dynamic Extensions1212589
+Node: VMS Installation Details1214274
+Node: VMS Running1216527
+Node: VMS GNV1220806
+Node: VMS Old Gawk1221541
+Node: Bugs1222012
+Node: Bug address1222675
+Node: Usenet1225657
+Node: Maintainers1226661
+Node: Other Versions1227922
+Node: Installation summary1234836
+Node: Notes1236038
+Node: Compatibility Mode1236832
+Node: Additions1237614
+Node: Accessing The Source1238539
+Node: Adding Code1239976
+Node: New Ports1246195
+Node: Derived Files1250683
+Ref: Derived Files-Footnote-11256329
+Ref: Derived Files-Footnote-21256364
+Ref: Derived Files-Footnote-31256962
+Node: Future Extensions1257076
+Node: Implementation Limitations1257734
+Node: Extension Design1258917
+Node: Old Extension Problems1260061
+Ref: Old Extension Problems-Footnote-11261579
+Node: Extension New Mechanism Goals1261636
+Ref: Extension New Mechanism Goals-Footnote-11265000
+Node: Extension Other Design Decisions1265189
+Node: Extension Future Growth1267302
+Node: Notes summary1268138
+Node: Basic Concepts1269313
+Node: Basic High Level1269994
+Ref: figure-general-flow1270276
+Ref: figure-process-flow1270961
+Ref: Basic High Level-Footnote-11274262
+Node: Basic Data Typing1274447
+Node: Glossary1277775
+Node: Copying1309613
+Node: GNU Free Documentation License1347156
+Node: Index1372276
End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index e1414bd..69ae409 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -59,7 +59,7 @@
@c applies to and all the info about who's publishing this edition
@c These apply across the board.
address@hidden UPDATE-MONTH February, 2019
address@hidden UPDATE-MONTH March, 2019
@set VERSION 5.0
@set PATCHLEVEL 0
@@ -5541,6 +5541,14 @@ You can combine regular expressions with special
characters,
called @dfn{regular expression operators} or @dfn{metacharacters}, to
increase the power and versatility of regular expressions.
address@hidden
+* Regexp Operator Details:: The actual details.
+* Interval Expressions:: Notes on interval expressions.
address@hidden menu
+
address@hidden Regexp Operator Details
address@hidden Regexp Operators in @command{awk}
+
The escape sequences described
@ifnotinfo
earlier
@@ -5718,6 +5726,26 @@ Matches @samp{whhhy}, @samp{whhhhy}, or @samp{whhhhhy}
only.
@item address@hidden,@}y
Matches @samp{whhy}, @samp{whhhy}, and so on.
@end table
address@hidden table
+
address@hidden precedence, regexp operators
address@hidden regular expressions, operators, precedence of
+In regular expressions, the @samp{*}, @samp{+}, and @samp{?} operators,
+as well as the braces @address@hidden and @address@hidden,
+have
+the highest precedence, followed by concatenation, and finally by @samp{|}.
+As in arithmetic, parentheses can change how operators are grouped.
+
address@hidden POSIX @command{awk}, regular expressions and
address@hidden @command{gawk}, regular expressions, precedence
+In POSIX @command{awk} and @command{gawk}, the @samp{*}, @samp{+}, and
address@hidden operators stand for themselves when there is nothing in the
+regexp that precedes them. For example, @code{/+/} matches a literal
+plus sign. However, many other versions of @command{awk} treat such a
+usage as a syntax error.
+
address@hidden Interval Expressions
address@hidden Some Notes On Interval Expressions
@cindex POSIX @command{awk}, interval expressions in
Interval expressions were not traditionally available in @command{awk}.
@@ -5745,26 +5773,14 @@ using a string constant with a regexp operator or
function.}
Finally, when @address@hidden and @address@hidden appear in regexp constants
in a way that cannot be interpreted as an interval expression
(such as @code{/address@hidden@}/}), then they stand for themselves.
address@hidden table
address@hidden precedence, regexp operators
address@hidden regular expressions, operators, precedence of
-In regular expressions, the @samp{*}, @samp{+}, and @samp{?} operators,
-as well as the braces @address@hidden and @address@hidden,
-have
-the highest precedence, followed by concatenation, and finally by @samp{|}.
-As in arithmetic, parentheses can change how operators are grouped.
-
address@hidden POSIX @command{awk}, regular expressions and
address@hidden @command{gawk}, regular expressions, precedence
-In POSIX @command{awk} and @command{gawk}, the @samp{*}, @samp{+}, and
address@hidden operators stand for themselves when there is nothing in the
-regexp that precedes them. For example, @code{/+/} matches a literal
-plus sign. However, many other versions of @command{awk} treat such a
-usage as a syntax error.
+As mentioned, interval expressions were not traditionally available
+in @command{awk}. In March of 2019, Brian Kernighan's
address@hidden (finally) acquired them.
-If @command{gawk} is in compatibility mode (@pxref{Options}), interval
-expressions are not available in regular expressions.
+Nonetheless, because they were not available for
+so many decades, @command{gawk} continues to not supply them
+when in compatibility mode (@pxref{Options}).
@node Bracket Expressions
@section Using Bracket Expressions
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index b685b7d..71f84be 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -54,7 +54,7 @@
@c applies to and all the info about who's publishing this edition
@c These apply across the board.
address@hidden UPDATE-MONTH February, 2019
address@hidden UPDATE-MONTH March, 2019
@set VERSION 5.0
@set PATCHLEVEL 0
@@ -5368,6 +5368,14 @@ You can combine regular expressions with special
characters,
called @dfn{regular expression operators} or @dfn{metacharacters}, to
increase the power and versatility of regular expressions.
address@hidden
+* Regexp Operator Details:: The actual details.
+* Interval Expressions:: Notes on interval expressions.
address@hidden menu
+
address@hidden Regexp Operator Details
address@hidden Regexp Operators in @command{awk}
+
The escape sequences described
@ifnotinfo
earlier
@@ -5545,6 +5553,26 @@ Matches @samp{whhhy}, @samp{whhhhy}, or @samp{whhhhhy}
only.
@item address@hidden,@}y
Matches @samp{whhy}, @samp{whhhy}, and so on.
@end table
address@hidden table
+
address@hidden precedence, regexp operators
address@hidden regular expressions, operators, precedence of
+In regular expressions, the @samp{*}, @samp{+}, and @samp{?} operators,
+as well as the braces @address@hidden and @address@hidden,
+have
+the highest precedence, followed by concatenation, and finally by @samp{|}.
+As in arithmetic, parentheses can change how operators are grouped.
+
address@hidden POSIX @command{awk}, regular expressions and
address@hidden @command{gawk}, regular expressions, precedence
+In POSIX @command{awk} and @command{gawk}, the @samp{*}, @samp{+}, and
address@hidden operators stand for themselves when there is nothing in the
+regexp that precedes them. For example, @code{/+/} matches a literal
+plus sign. However, many other versions of @command{awk} treat such a
+usage as a syntax error.
+
address@hidden Interval Expressions
address@hidden Some Notes On Interval Expressions
@cindex POSIX @command{awk}, interval expressions in
Interval expressions were not traditionally available in @command{awk}.
@@ -5572,26 +5600,14 @@ using a string constant with a regexp operator or
function.}
Finally, when @address@hidden and @address@hidden appear in regexp constants
in a way that cannot be interpreted as an interval expression
(such as @code{/address@hidden@}/}), then they stand for themselves.
address@hidden table
address@hidden precedence, regexp operators
address@hidden regular expressions, operators, precedence of
-In regular expressions, the @samp{*}, @samp{+}, and @samp{?} operators,
-as well as the braces @address@hidden and @address@hidden,
-have
-the highest precedence, followed by concatenation, and finally by @samp{|}.
-As in arithmetic, parentheses can change how operators are grouped.
-
address@hidden POSIX @command{awk}, regular expressions and
address@hidden @command{gawk}, regular expressions, precedence
-In POSIX @command{awk} and @command{gawk}, the @samp{*}, @samp{+}, and
address@hidden operators stand for themselves when there is nothing in the
-regexp that precedes them. For example, @code{/+/} matches a literal
-plus sign. However, many other versions of @command{awk} treat such a
-usage as a syntax error.
+As mentioned, interval expressions were not traditionally available
+in @command{awk}. In March of 2019, Brian Kernighan's
address@hidden (finally) acquired them.
-If @command{gawk} is in compatibility mode (@pxref{Options}), interval
-expressions are not available in regular expressions.
+Nonetheless, because they were not available for
+so many decades, @command{gawk} continues to not supply them
+when in compatibility mode (@pxref{Options}).
@node Bracket Expressions
@section Using Bracket Expressions
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=d00a702b26ce45b3723d54f105b21181d64158ac
commit d00a702b26ce45b3723d54f105b21181d64158ac
Author: Arnold D. Robbins <address@hidden>
Date: Fri Mar 8 12:13:21 2019 +0200
Add generated files.
diff --git a/doc/gawk.info b/doc/gawk.info
index b8ab270..941d684 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -35616,9 +35616,9 @@ Index
* list debugger command: Miscellaneous Debugger Commands.
(line 73)
* list function definitions, in debugger: Debugger Info. (line 30)
+* loading extensions: Options. (line 198)
* loading extensions, @load directive: Loading Shared Libraries.
(line 8)
-* loading, extensions: Options. (line 198)
* local variables, in a function: Variable Scope. (line 6)
* locale categories: Explaining gettext. (line 81)
* locale decimal point character: Options. (line 294)
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 7a8354e..e1414bd 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -4085,7 +4085,7 @@ at their beginning. @xref{Changing The Namespace}, for
more information.
@itemx @option{--load} @var{ext}
@cindex @option{-l} option
@cindex @option{--load} option
address@hidden loading, extensions
address@hidden loading extensions
Load a dynamic extension named @var{ext}. Extensions
are stored as system shared libraries.
This option searches for the library using the @env{AWKLIBPATH}
@@ -9327,7 +9327,7 @@ current record (such as @code{$1}), variables, or any
@command{awk}
expression. Numeric values are converted to strings and then printed.
@cindex records, printing
address@hidden lines, blank, printing
address@hidden lines, address@hidden printing
@cindex text, printing
The simple statement @samp{print} with no items is equivalent to
@samp{print $0}: it prints the entire current record. To print a blank
@@ -23879,7 +23879,7 @@ uses these functions.
@cindex libraries of @command{awk} functions, group database, reading
@cindex functions, library, group address@hidden reading
@cindex group database, reading
address@hidden database, group, reading
address@hidden database, address@hidden reading
@cindex @code{PROCINFO} array, group membership and
@cindex @code{getgrent()} function (C library)
@cindex @code{getgrent()} user-defined function
@@ -25573,7 +25573,7 @@ END @{
@c FIXME: One day, update to current POSIX version of uniq
@cindex printing, unduplicated lines of text
address@hidden address@hidden printing, unduplicated lines of
address@hidden text, printing, unduplicated lines of
@cindex @command{uniq} utility
The @command{uniq} utility reads sorted lines of data on its standard
input, and by default removes duplicate lines. In other words, it only
@@ -29212,7 +29212,7 @@ is a count showing how many times the condition was
true.
The count for the @code{else}
indicates how many times the test failed.
address@hidden loops, count for header, in a profile
address@hidden loops, count for address@hidden in a profile
@item
The count for a loop header (such as @code{for}
or @code{while}) shows how many times the loop test was executed.
@@ -29371,8 +29371,8 @@ Once upon a time, the @option{--pretty-print} option
would also run
your program. This is is no longer the case.
@end quotation
address@hidden profiling, pretty-printing, difference with
address@hidden pretty-printing, profiling, difference with
address@hidden profiling, address@hidden difference with
address@hidden pretty-printing, address@hidden difference with
There is a significant difference between the output created when
profiling, and that created when pretty-printing. Pretty-printed output
preserves the original comments that were in the program, although their
@@ -40598,7 +40598,7 @@ various non-Unix systems.
@node PC Installation
@appendixsubsec Installation on MS-Windows
address@hidden PC operating address@hidden @command{gawk} on, installing
address@hidden PC operating systems, @command{gawk} on, installing
@cindex operating systems, address@hidden @command{gawk} on, installing
This @value{SECTION} covers installation and usage of @command{gawk}
on Intel architecture machines running any version of MS-Windows.
@@ -40648,7 +40648,7 @@ type @samp{make mingw32}.
@node PC Using
@appendixsubsubsec Using @command{gawk} on PC Operating Systems
address@hidden operating systems, PC, @command{gawk} on
address@hidden operating systems, address@hidden @command{gawk} on
@cindex PC operating systems, @command{gawk} on
Information in this section applies to the MinGW and
@@ -41653,7 +41653,7 @@ maintainers of @command{gawk}. Everything in it
applies specifically to
@cindex @command{gawk}, implementation issues, downward compatibility
@cindex @command{gawk}, implementation issues, debugging
@cindex troubleshooting, @command{gawk}
address@hidden implementation address@hidden @command{gawk}, debugging
address@hidden implementation issues, @command{gawk}, debugging
@xref{POSIX/GNU},
for a summary of the GNU extensions to the @command{awk} language and program.
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=83a5b6f87902d0a3e4cd709eabd6d88ddf471829
commit 83a5b6f87902d0a3e4cd709eabd6d88ddf471829
Author: Arnold D. Robbins <address@hidden>
Date: Fri Mar 8 11:50:07 2019 +0200
First pass at indexing improvements.
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 1aa632d..b685b7d 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -3995,7 +3995,7 @@ at their beginning. @xref{Changing The Namespace}, for
more information.
@itemx @option{--load} @var{ext}
@cindex @option{-l} option
@cindex @option{--load} option
address@hidden loading, extensions
address@hidden loading extensions
Load a dynamic extension named @var{ext}. Extensions
are stored as system shared libraries.
This option searches for the library using the @env{AWKLIBPATH}
@@ -8925,7 +8925,7 @@ current record (such as @code{$1}), variables, or any
@command{awk}
expression. Numeric values are converted to strings and then printed.
@cindex records, printing
address@hidden lines, blank, printing
address@hidden lines, address@hidden printing
@cindex text, printing
The simple statement @samp{print} with no items is equivalent to
@samp{print $0}: it prints the entire current record. To print a blank
@@ -22891,7 +22891,7 @@ uses these functions.
@cindex libraries of @command{awk} functions, group database, reading
@cindex functions, library, group address@hidden reading
@cindex group database, reading
address@hidden database, group, reading
address@hidden database, address@hidden reading
@cindex @code{PROCINFO} array, group membership and
@cindex @code{getgrent()} function (C library)
@cindex @code{getgrent()} user-defined function
@@ -24585,7 +24585,7 @@ END @{
@c FIXME: One day, update to current POSIX version of uniq
@cindex printing, unduplicated lines of text
address@hidden address@hidden printing, unduplicated lines of
address@hidden text, printing, unduplicated lines of
@cindex @command{uniq} utility
The @command{uniq} utility reads sorted lines of data on its standard
input, and by default removes duplicate lines. In other words, it only
@@ -28224,7 +28224,7 @@ is a count showing how many times the condition was
true.
The count for the @code{else}
indicates how many times the test failed.
address@hidden loops, count for header, in a profile
address@hidden loops, count for address@hidden in a profile
@item
The count for a loop header (such as @code{for}
or @code{while}) shows how many times the loop test was executed.
@@ -28383,8 +28383,8 @@ Once upon a time, the @option{--pretty-print} option
would also run
your program. This is is no longer the case.
@end quotation
address@hidden profiling, pretty-printing, difference with
address@hidden pretty-printing, profiling, difference with
address@hidden profiling, address@hidden difference with
address@hidden pretty-printing, address@hidden difference with
There is a significant difference between the output created when
profiling, and that created when pretty-printing. Pretty-printed output
preserves the original comments that were in the program, although their
@@ -39571,7 +39571,7 @@ various non-Unix systems.
@node PC Installation
@appendixsubsec Installation on MS-Windows
address@hidden PC operating address@hidden @command{gawk} on, installing
address@hidden PC operating systems, @command{gawk} on, installing
@cindex operating systems, address@hidden @command{gawk} on, installing
This @value{SECTION} covers installation and usage of @command{gawk}
on Intel architecture machines running any version of MS-Windows.
@@ -39621,7 +39621,7 @@ type @samp{make mingw32}.
@node PC Using
@appendixsubsubsec Using @command{gawk} on PC Operating Systems
address@hidden operating systems, PC, @command{gawk} on
address@hidden operating systems, address@hidden @command{gawk} on
@cindex PC operating systems, @command{gawk} on
Information in this section applies to the MinGW and
@@ -40626,7 +40626,7 @@ maintainers of @command{gawk}. Everything in it
applies specifically to
@cindex @command{gawk}, implementation issues, downward compatibility
@cindex @command{gawk}, implementation issues, debugging
@cindex troubleshooting, @command{gawk}
address@hidden implementation address@hidden @command{gawk}, debugging
address@hidden implementation issues, @command{gawk}, debugging
@xref{POSIX/GNU},
for a summary of the GNU extensions to the @command{awk} language and program.
-----------------------------------------------------------------------
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, feature/better-index, created. gawk-4.1.0-3706-g5a52833,
Arnold Robbins <=