\unnumbchapentry{Foreword}{0}{1}
\unnumbchapentry{Preface}{0}{3}
\unnumbsecentry{History of \command {awk} and \command {gawk}}{0}{0}{3}
\unnumbsecentry{A Rose by Any Other Name}{0}{0}{4}
\unnumbsecentry{Using This Book}{0}{0}{4}
\unnumbsecentry{Typographical Conventions}{0}{0}{6}
\unnumbsecentry{The GNU Project and This Book}{0}{0}{7}
\unnumbsecentry{How to Contribute}{0}{0}{8}
\unnumbsecentry{Acknowledgments}{0}{0}{8}
\chapentry{Getting Started with \command {awk}}{1}{11}
\secentry{How to Run \command {awk} Programs}{1}{1}{11}
\subsecentry{One-Shot Throwaway \command {awk} Programs}{1}{1}{1}{11}
\subsecentry{Running \command {awk} Without Input Files}{1}{1}{2}{12}
\subsecentry{Running Long Programs}{1}{1}{3}{12}
\subsecentry{Executable \command {awk} Programs}{1}{1}{4}{13}
\subsecentry{Comments in \command {awk} Programs}{1}{1}{5}{14}
\subsecentry{Shell-Quoting Issues}{1}{1}{6}{15}
\secentry{Data Files for the Examples}{1}{2}{16}
\secentry{Some Simple Examples}{1}{3}{17}
\secentry{An Example with Two Rules}{1}{4}{19}
\secentry{A More Complex Example}{1}{5}{19}
\secentry{\command {awk} Statements Versus Lines}{1}{6}{20}
\secentry{Other Features of \command {awk}}{1}{7}{22}
\secentry{When to Use \command {awk}}{1}{8}{22}
\chapentry{Regular Expressions}{2}{24}
\secentry{How to Use Regular Expressions}{2}{1}{24}
\secentry{Escape Sequences}{2}{2}{25}
\secentry{Regular Expression Operators}{2}{3}{27}
\secentry{Using Character Lists}{2}{4}{29}
\secentry{\command {gawk}-Specific Regexp Operators}{2}{5}{31}
\secentry{Case Sensitivity in Matching}{2}{6}{32}
\secentry{How Much Text Matches?}{2}{7}{33}
\secentry{Using Dynamic Regexps}{2}{8}{33}
\secentry{Where You Are Makes A Difference}{2}{9}{35}
\chapentry{Reading Input Files}{3}{36}
\secentry{How Input Is Split into Records}{3}{1}{36}
\secentry{Examining Fields}{3}{2}{39}
\secentry{Nonconstant Field Numbers}{3}{3}{40}
\secentry{Changing the Contents of a Field}{3}{4}{41}
\secentry{Specifying How Fields Are Separated}{3}{5}{43}
\subsecentry{Using Regular Expressions to Separate Fields}{3}{5}{1}{44}
\subsecentry{Making Each Character a Separate Field}{3}{5}{2}{44}
\subsecentry{Setting \code {FS} from the Command Line}{3}{5}{3}{45}
\subsecentry{Field-Splitting Summary}{3}{5}{4}{46}
\secentry{Reading Fixed-Width Data}{3}{6}{47}
\secentry{Multiple-Line Records}{3}{7}{49}
\secentry{Explicit Input with \code {getline}}{3}{8}{51}
\subsecentry{Using \code {getline} with No Arguments}{3}{8}{1}{52}
\subsecentry{Using \code {getline} into a Variable}{3}{8}{2}{53}
\subsecentry{Using \code {getline} from a File}{3}{8}{3}{53}
\subsecentry{Using \code {getline} into a Variable from a File}{3}{8}{4}{54}
\subsecentry{Using \code {getline} from a Pipe}{3}{8}{5}{54}
\subsecentry{Using \code {getline} into a Variable from a Pipe}{3}{8}{6}{55}
\subsecentry{Using \code {getline} from a Coprocess}{3}{8}{7}{56}
\subsecentry{Using \code {getline} into a Variable from a Coprocess}{3}{8}{8}{56}
\subsecentry{Points to Remember About \code {getline}}{3}{8}{9}{56}
\subsecentry{Summary of \code {getline} Variants}{3}{8}{10}{57}
\chapentry{Printing Output}{4}{58}
\secentry{The \code {print} Statement}{4}{1}{58}
\secentry{Examples of \code {print} Statements}{4}{2}{58}
\secentry{Output Separators}{4}{3}{60}
\secentry{Controlling Numeric Output with \code {print}}{4}{4}{60}
\secentry{Using \code {printf} Statements for Fancier Printing}{4}{5}{61}
\subsecentry{Introduction to the \code {printf} Statement}{4}{5}{1}{61}
\subsecentry{Format-Control Letters}{4}{5}{2}{61}
\subsecentry{Modifiers for \code {printf} Formats}{4}{5}{3}{62}
\subsecentry{Examples Using \code {printf}}{4}{5}{4}{64}
\secentry{Redirecting Output of \code {print} and \code {printf}}{4}{6}{65}
\secentry{Special File Names in \command {gawk}}{4}{7}{68}
\subsecentry{Special Files for Standard Descriptors}{4}{7}{1}{68}
\subsecentry{Special Files for Process-Related Information}{4}{7}{2}{69}
\subsecentry{Special Files for Network Communications}{4}{7}{3}{70}
\subsecentry{Special File Name Caveats}{4}{7}{4}{70}
\secentry{Closing Input and Output Redirections}{4}{8}{71}
\chapentry{Expressions}{5}{74}
\secentry{Constant Expressions}{5}{1}{74}
\subsecentry{Numeric and String Constants}{5}{1}{1}{74}
\subsecentry{Octal and Hexadecimal Numbers}{5}{1}{2}{74}
\subsecentry{Regular Expression Constants}{5}{1}{3}{75}
\secentry{Using Regular Expression Constants}{5}{2}{76}
\secentry{Variables}{5}{3}{77}
\subsecentry{Using Variables in a Program}{5}{3}{1}{77}
\subsecentry{Assigning Variables on the Command Line}{5}{3}{2}{77}
\secentry{Conversion of Strings and Numbers}{5}{4}{78}
\secentry{Arithmetic Operators}{5}{5}{79}
\secentry{String Concatenation}{5}{6}{80}
\secentry{Assignment Expressions}{5}{7}{82}
\secentry{Increment and Decrement Operators}{5}{8}{84}
\secentry{True and False in \command {awk}}{5}{9}{85}
\secentry{Variable Typing and Comparison Expressions}{5}{10}{86}
\secentry{Boolean Expressions}{5}{11}{88}
\secentry{Conditional Expressions}{5}{12}{90}
\secentry{Function Calls}{5}{13}{90}
\secentry{Operator Precedence (How Operators Nest)}{5}{14}{91}
\chapentry{Patterns, Actions, and Variables}{6}{94}
\secentry{Pattern Elements}{6}{1}{94}
\subsecentry{Regular Expressions as Patterns}{6}{1}{1}{94}
\subsecentry{Expressions as Patterns}{6}{1}{2}{94}
\subsecentry{Specifying Record Ranges with Patterns}{6}{1}{3}{96}
\subsecentry{The \code {BEGIN} and \code {END} Special Patterns}{6}{1}{4}{97}
\subsubsecentry{Startup and Cleanup Actions}{6}{1}{4}{1}{97}
\subsubsecentry{Input/Output from \code {BEGIN} and \code {END} Rules}{6}{1}{4}{2}{98}
\subsecentry{The Empty Pattern}{6}{1}{5}{98}
\secentry{Using Shell Variables in Programs}{6}{2}{99}
\secentry{Actions}{6}{3}{99}
\secentry{Control Statements in Actions}{6}{4}{100}
\subsecentry{The \code {if}-\code {else} Statement}{6}{4}{1}{101}
\subsecentry{The \code {while} Statement}{6}{4}{2}{101}
\subsecentry{The \code {do}-\code {while} Statement}{6}{4}{3}{102}
\subsecentry{The \code {for} Statement}{6}{4}{4}{102}
\subsecentry{The \code {break} Statement}{6}{4}{5}{103}
\subsecentry{The \code {continue} Statement}{6}{4}{6}{104}
\subsecentry{The \code {next} Statement}{6}{4}{7}{105}
\subsecentry{Using \command {gawk}'s \code {nextfile} Statement}{6}{4}{8}{106}
\subsecentry{The \code {exit} Statement}{6}{4}{9}{107}
\secentry{Built-in Variables}{6}{5}{108}
\subsecentry{Built-in Variables That Control \command {awk}}{6}{5}{1}{108}
\subsecentry{Built-in Variables That Convey Information}{6}{5}{2}{110}
\subsecentry{Using \code {ARGC} and \code {ARGV}}{6}{5}{3}{114}
\chapentry{Arrays in \command {awk}}{7}{116}
\secentry{Introduction to Arrays}{7}{1}{116}
\secentry{Referring to an Array Element}{7}{2}{117}
\secentry{Assigning Array Elements}{7}{3}{118}
\secentry{Basic Array Example}{7}{4}{118}
\secentry{Scanning All Elements of an Array}{7}{5}{119}
\secentry{The \code {delete} Statement}{7}{6}{120}
\secentry{Using Numbers to Subscript Arrays}{7}{7}{121}
\secentry{Using Uninitialized Variables as Subscripts}{7}{8}{122}
\secentry{Multidimensional Arrays}{7}{9}{122}
\secentry{Scanning Multidimensional Arrays}{7}{10}{124}
\secentry{Sorting Array Values and Indices with \command {gawk}}{7}{11}{124}
\chapentry{Functions}{8}{127}
\secentry{Built-in Functions}{8}{1}{127}
\subsecentry{Calling Built-in Functions}{8}{1}{1}{127}
\subsecentry{Numeric Functions}{8}{1}{2}{127}
\subsecentry{String-Manipulation Functions}{8}{1}{3}{129}
\subsubsecentry{More About \samp {{\tt \rawbackslashxx }} and \samp {&} with \code {sub}, \code {gsub}, and \code {gensub}}{8}{1}{3}{1}{136}
\subsecentry{Input/Output Functions}{8}{1}{4}{139}
\subsecentry{Using \command {gawk}'s Timestamp Functions}{8}{1}{5}{141}
\subsecentry{Bit-Manipulation Functions of \command {gawk}}{8}{1}{6}{146}
\subsecentry{Using \command {gawk}'s String-Translation Functions}{8}{1}{7}{148}
\secentry{User-Defined Functions}{8}{2}{148}
\subsecentry{Function Definition Syntax}{8}{2}{1}{148}
\subsecentry{Function Definition Examples}{8}{2}{2}{150}
\subsecentry{Calling User-Defined Functions}{8}{2}{3}{151}
\subsecentry{The \code {return} Statement}{8}{2}{4}{153}
\subsecentry{Functions and Their Effects on Variable Typing}{8}{2}{5}{154}
\chapentry{Internationalization with \command {gawk}}{9}{155}
\secentry{Internationalization and Localization}{9}{1}{155}
\secentry{GNU \code {gettext}}{9}{2}{155}
\secentry{Internationalizing \command {awk} Programs}{9}{3}{157}
\secentry{Translating \command {awk} Programs}{9}{4}{158}
\subsecentry{Extracting Marked Strings}{9}{4}{1}{159}
\subsecentry{Rearranging \code {printf} Arguments}{9}{4}{2}{159}
\subsecentry{\command {awk} Portability Issues}{9}{4}{3}{160}
\secentry{A Simple Internationalization Example}{9}{5}{161}
\secentry{\command {gawk} Can Speak Your Language}{9}{6}{163}
\chapentry{Advanced Features of \command {gawk}}{10}{164}
\secentry{Allowing Nondecimal Input Data}{10}{1}{164}
\secentry{Two-Way Communications with Another Process}{10}{2}{164}
\secentry{Using \command {gawk} for Network Programming}{10}{3}{167}
\secentry{Using \command {gawk} with BSD Portals}{10}{4}{168}
\secentry{Profiling Your \command {awk} Programs}{10}{5}{168}
\chapentry{Running \command {awk} and \command {gawk}}{11}{172}
\secentry{Invoking \command {awk}}{11}{1}{172}
\secentry{Command-Line Options}{11}{2}{172}
\secentry{Other Command-Line Arguments}{11}{3}{176}
\secentry{The \env {AWKPATH} Environment Variable}{11}{4}{177}
\secentry{Obsolete Options and/or Features}{11}{5}{178}
\secentry{Undocumented Options and Features}{11}{6}{178}
\secentry{Known Bugs in \command {gawk}}{11}{7}{179}
\chapentry{A Library of \command {awk} Functions}{12}{180}
\secentry{Naming Library Function Global Variables}{12}{1}{180}
\secentry{General Programming}{12}{2}{181}
\subsecentry{Implementing \code {nextfile} as a Function}{12}{2}{1}{182}
\subsecentry{Assertions}{12}{2}{2}{183}
\subsecentry{Rounding Numbers}{12}{2}{3}{184}
\subsecentry{The Cliff Random Number Generator}{12}{2}{4}{185}
\subsecentry{Translating Between Characters and Numbers}{12}{2}{5}{186}
\subsecentry{Merging an Array into a String}{12}{2}{6}{187}
\subsecentry{Managing the Time of Day}{12}{2}{7}{188}
\secentry{Data File Management}{12}{3}{190}
\subsecentry{Noting Data File Boundaries}{12}{3}{1}{190}
\subsecentry{Rereading the Current File}{12}{3}{2}{191}
\subsecentry{Checking for Readable Data Files}{12}{3}{3}{192}
\subsecentry{Treating Assignments as File Names}{12}{3}{4}{192}
\secentry{Processing Command-Line Options}{12}{4}{193}
\secentry{Reading the User Database}{12}{5}{198}
\secentry{Reading the Group Database}{12}{6}{202}
\chapentry{Practical \command {awk} Programs}{13}{207}
\secentry{Running the Example Programs}{13}{1}{207}
\secentry{Reinventing Wheels for Fun and Profit}{13}{2}{207}
\subsecentry{Cutting out Fields and Columns}{13}{2}{1}{207}
\subsecentry{Searching for Regular Expressions in Files}{13}{2}{2}{212}
\subsecentry{Printing out User Information}{13}{2}{3}{216}
\subsecentry{Splitting a Large File into Pieces}{13}{2}{4}{218}
\subsecentry{Duplicating Output into Multiple Files}{13}{2}{5}{220}
\subsecentry{Printing Nonduplicated Lines of Text}{13}{2}{6}{221}
\subsecentry{Counting Things}{13}{2}{7}{225}
\secentry{A Grab Bag of \command {awk} Programs}{13}{3}{227}
\subsecentry{Finding Duplicated Words in a Document}{13}{3}{1}{228}
\subsecentry{An Alarm Clock Program}{13}{3}{2}{228}
\subsecentry{Transliterating Characters}{13}{3}{3}{231}
\subsecentry{Printing Mailing Labels}{13}{3}{4}{233}
\subsecentry{Generating Word-Usage Counts}{13}{3}{5}{235}
\subsecentry{Removing Duplicates from Unsorted Text}{13}{3}{6}{236}
\subsecentry{Extracting Programs from Texinfo Source Files}{13}{3}{7}{237}
\subsecentry{A Simple Stream Editor}{13}{3}{8}{240}
\subsecentry{An Easy Way to Use Library Functions}{13}{3}{9}{242}
\appendixentry{The Evolution of the \command {awk} Language}{A}{249}
\secentry{Major Changes Between V7 and SVR3.1}{A}{1}{249}
\secentry{Changes Between SVR3.1 and SVR4}{A}{2}{250}
\secentry{Changes Between SVR4 and POSIX \command {awk}}{A}{3}{250}
\secentry{Extensions in the Bell Laboratories \command {awk}}{A}{4}{251}
\secentry{Extensions in \command {gawk} Not in POSIX \command {awk}}{A}{5}{251}
\secentry{Major Contributors to \command {gawk}}{A}{6}{255}
\appendixentry{Installing \command {gawk}}{B}{257}
\secentry{The \command {gawk} Distribution}{B}{1}{257}
\subsecentry{Getting the \command {gawk} Distribution}{B}{1}{1}{257}
\subsecentry{Extracting the Distribution}{B}{1}{2}{257}
\subsecentry{Contents of the \command {gawk} Distribution}{B}{1}{3}{258}
\secentry{Compiling and Installing \command {gawk} on Unix}{B}{2}{260}
\subsecentry{Compiling \command {gawk} for Unix}{B}{2}{1}{261}
\subsecentry{Additional Configuration Options}{B}{2}{2}{261}
\subsecentry{The Configuration Process}{B}{2}{3}{262}
\secentry{Installation on Other Operating Systems}{B}{3}{262}
\subsecentry{Installing \command {gawk} on an Amiga}{B}{3}{1}{263}
\subsecentry{Installing \command {gawk} on BeOS}{B}{3}{2}{263}
\subsecentry{Installation on PC Operating Systems}{B}{3}{3}{263}
\subsubsecentry{Installing a Prepared Distribution for PC Systems}{B}{3}{3}{1}{264}
\subsubsecentry{Compiling \command {gawk} for PC Operating Systems}{B}{3}{3}{2}{264}
\subsubsecentry{Using \command {gawk} on PC Operating Systems}{B}{3}{3}{3}{266}
\subsubsecentry{Using \command {gawk} In The Cygwin Environment}{B}{3}{3}{4}{267}
\subsecentry{How to Compile and Install \command {gawk} on VMS}{B}{3}{4}{268}
\subsubsecentry{Compiling \command {gawk} on VMS}{B}{3}{4}{1}{268}
\subsubsecentry{Installing \command {gawk} on VMS}{B}{3}{4}{2}{268}
\subsubsecentry{Running \command {gawk} on VMS}{B}{3}{4}{3}{269}
\subsubsecentry{Building and Using \command {gawk} on VMS POSIX}{B}{3}{4}{4}{270}
\secentry{Unsupported Operating System Ports}{B}{4}{270}
\subsecentry{Installing \command {gawk} on the Atari ST}{B}{4}{1}{270}
\subsubsecentry{Compiling \command {gawk} on the Atari ST}{B}{4}{1}{1}{270}
\subsubsecentry{Running \command {gawk} on the Atari ST}{B}{4}{1}{2}{271}
\subsecentry{Installing \command {gawk} on a Tandem}{B}{4}{2}{272}
\secentry{Reporting Problems and Bugs}{B}{5}{272}
\secentry{Other Freely Available \command {awk} Implementations}{B}{6}{273}
\appendixentry{Implementation Notes}{C}{276}
\secentry{Downward Compatibility and Debugging}{C}{1}{276}
\secentry{Making Additions to \command {gawk}}{C}{2}{276}
\subsecentry{Adding New Features}{C}{2}{1}{276}
\subsecentry{Porting \command {gawk} to a New Operating System}{C}{2}{2}{278}
\secentry{Adding New Built-in Functions to \command {gawk}}{C}{3}{279}
\subsecentry{A Minimal Introduction to \command {gawk} Internals}{C}{3}{1}{279}
\subsecentry{Directory and File Operation Built-ins}{C}{3}{2}{282}
\subsubsecentry{Using \code {chdir} and \code {stat}}{C}{3}{2}{1}{282}
\subsubsecentry{C Code for \code {chdir} and \code {stat}}{C}{3}{2}{2}{284}
\subsubsecentry{Integrating the Extensions}{C}{3}{2}{3}{287}
\secentry{Probable Future Extensions}{C}{4}{288}
\appendixentry{Basic Programming Concepts}{D}{291}
\secentry{What a Program Does}{D}{1}{291}
\secentry{Data Values in a Computer}{D}{2}{292}
\secentry{Floating-Point Number Caveats}{D}{3}{293}
\unnumbchapentry{Glossary}{13}{296}
\unnumbchapentry{GNU General Public License}{13}{306}
\unnumbsecentry{Preamble}{13}{0}{306}
\unnumbsecentry{Terms and Conditions for Copying, Distribution and Modification}{13}{0}{306}
\unnumbsecentry{How to Apply These Terms to Your New Programs}{13}{0}{311}
\unnumbchapentry{GNU Free Documentation License}{13}{312}
\unnumbsecentry{ADDENDUM: How to use this License for your documents}{13}{0}{317}
\unnumbchapentry{Index}{13}{319}
