-
The awk Language and gawk
-
Chapter 1 Getting Started with awk
- How to Run awk Programs
- Datafiles for the Examples
- Some Simple Examples
- An Example with Two Rules
- A More Complex Example
- awk Statements Versus Lines
- Other Features of awk
- When to Use awk
-
Chapter 2 Regular Expressions
- How to Use Regular Expressions
- Escape Sequences
- Regular Expression Operators
- Using Character Lists
- gawk-Specific Regexp Operators
- Case Sensitivity in Matching
- How Much Text Matches?
- Using Dynamic Regexps
-
Chapter 3 Reading Input Files
- How Input Is Split into Records
- Examining Fields
- Non-constant Field Numbers
- Changing the Contents of a Field
- Specifying How Fields Are Separated
- Reading Fixed-Width Data
- Multiple-Line Records
- Explicit Input with getline
-
Chapter 4 Printing Output
- The print Statement
- Examples of print Statements
- Output Separators
- Controlling Numeric Output with print
- Using printf Statements for Fancier Printing
- Redirecting Output of print and printf
- Special Filenames in gawk
- Closing Input and Output Redirections
-
Chapter 5 Expressions
- Constant Expressions
- Using Regular Expression Constants
- Variables
- Conversion of Strings and Numbers
- Arithmetic Operators
- String Concatenation
- Assignment Expressions
- Increment and Decrement Operators
- True and False in awk
- Variable Typing and Comparison Expressions
- Boolean Expressions
- Conditional Expressions
- Function Calls
- Operator Precedence (How Operators Nest)
-
Chapter 6 Patterns, Actions, and Variables
- Pattern Elements
- Using Shell Variables in Programs
- Actions
- Control Statements in Actions
- Built-in Variables
-
Chapter 7 Arrays in awk
- Introduction to Arrays
- Referring to an Array Element
- Assigning Array Elements
- Basic Array Example
- Scanning All Elements of an Array
- The delete Statement
- Using Numbers to Subscript Arrays
- Using Uninitialized Variables as Subscripts
- Multidimensional Arrays
- Scanning Multidimensional Arrays
- Sorting Array Values and Indices with gawk
-
Chapter 8 Functions
- Built-in Functions
- User-Defined Functions
-
Chapter 9 Internationalization with gawk
- Internationalization and Localization
- GNU gettext
- Internationalizing awk Programs
- Translating awk Programs
- A Simple Internationalization Example
- gawk Can Speak Your Language
-
Chapter 10 Advanced Features of gawk
- Allowing Nondecimal Input Data
- Two-Way Communications with Another Process
- Using gawk for Network Programming
- Using gawk with BSD Portals
- Profiling Your awk Programs
-
Chapter 11 Running awk and gawk
- Invoking awk
- Command-Line Options
- Other Command-Line Arguments
- The AWKPATH Environment Variable
- Obsolete Options and/or Features
- Known Bugs in gawk
-
-
Using awk and gawk
-
Chapter 12 A Library of awk Functions
- Naming Library Function Global Variables
- General Programming
- Datafile Management
- Processing Command-Line Options
- Reading the User Database
- Reading the Group Database
-
Chapter 13 Practical awk Programs
- Running the Example Programs
- Reinventing Wheels for Fun and Profit
- A Grab Bag of awk Programs
-
Chapter 14 Internetworking with gawk
- Networking with gawk
- Some Applications and Techniques
- Related Links
-
-
Appendixes
-
Appendix A The Evolution of the awk Language
- Major Changes Between V7 and SVR3.1
- Changes Between SVR3.1 and SVR4
- Changes Between SVR4 and POSIX awk
- Extensions in the Bell Laboratories awk
- Extensions in gawk Not in POSIX awk
- Major Contributors to gawk
-
Appendix B Installing gawk
- The gawk Distribution
- Compiling and Installing gawk on Unix
- Installation on PC Operating Systems
- Reporting Problems and Bugs
- Other Freely Available awk Implementations
-
Appendix C Implementation Notes
- Downward Compatibility and Debugging
- Making Additions to gawk
- Adding New Built-in Functions to gawk
- Probable Future Extensions
-
Appendix D Basic Programming Concepts
- What a Program Does
- Data Values in a Computer
- Floating-Point Number Caveats
-
Appendix E GNU General Public License
- Preamble
- Terms and Conditions for Copying, Distribution, and Modification
- NO WARRANTY
- END OF TERMS AND CONDITIONS
-
Appendix F GNU Free Documentation License
- ADDENDUM: How to Use This License for Your Documents
-
-
Glossary
-
Colophon
- Title:
- Effective awk Programming, Third Edition
- By:
- Arnold Robbins
- Publisher:
- O'Reilly Media
- Formats:
-
- Ebook
- Safari Books Online
- Print Release:
- May 2001
- Ebook Release:
- June 2009
- Pages:
- 456
- Print ISBN:
- 978-0-596-00070-7
- | ISBN 10:
- 0-596-00070-7
- Ebook ISBN:
- 978-0-596-55594-8
- | ISBN 10:
- 0-596-55594-6
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The animal on the cover of Effective awk Programming, Third Edition, is a great auk, a powerful symbol of nineteenth-century European and American arrogance toward nature. In using great auks as food and for their oil, and later collecting specimen for the kind of trivial display so popular with the inhabitants of mansions in Victorian England, mankind showed no mercy; mankind did not take care to effectively manage the few delicate populations as sustainable resources, much less treat the great auk as a living species worthy of respect. In 1844, sailors working for a British collector killed the last two great auks and stole their incubating egg on an island off the coast of Iceland.
The original penguin, great auks were large, black and white, flightless seabirds with pronounced, bent, orange beaks. The auks nested for three to four weeks each spring on craggy islands in the North Atlantic. When not nesting with their lifelong mates, great auks swam the seas in extended-family groups, occasionally deep-sea diving for large fish. Sixteenth-century sailors who exploited nesting populations for food during long voyages called the birds penguins, a name they also gave to the smaller-beaked seabirds of the Southern Hemisphere that still exist today. Jeffrey Holcomb was the production editor for Effective awk Programming, Third Edition. Claire Cloutier was the production manager. Mary Brady was the copyeditor, and Maureen Dempsey was the proofreader. Rachel Wheeler, Matt Hutchinson, and Claire Cloutier provided quality control. Kimo Carter and Matt Hutchinson provided production support. Arnold Robbins and Nancy Crumpton wrote the index. Hanna Dyer designed the cover of this book, based on a series design by Edie Freedman. The cover image is a 19th-century engraving from Century Illustrated Monthly Magazine. Emma Colby produced the cover layout with QuarXPress 4.1 using Adobe's ITC Garamond font.
David Futato designed the interior layout based on a series design by Nancy Priest. Using a version of makeinfo modified by Phillippe Martin to create DocBook and enhanced by the author, the book was converted by the author from the Texinfo source into DocBook XML. Arnold then post-processed the generated DocBook with no less than six awk scripts (of course!), finally tuning the DocBook source files by hand. The print version of this book was created by translating the DocBook XML markup of its source files into a set of
groff macros using a filter developed at O'Reilly & Associates by Norman Walsh. Steve Talbott designed and wrote the underlying macro set on the basis of the GNU troff "mgs macros; Lenny Muellner adapted them to XML and implemented the book design. The GNU
groff text formatter Version 1.11.1 was used to generate PostScript output. The text and heading fonts are ITC Garamond Light and Garamond Book; the code font is Constant Willison. The illustrations that appear in the book were produced by Robert Romano and Jessamyn Read using Macromedia FreeHand 9 and Adobe Photoshop 6. This colophon was written by Sarah Jane Shangraw.
