Synopses & Reviews
Effective awk Programming,3rd Edition, focuses entirely onawk, exploring it in the greatest depth of the three awk titles we carry. It's an excellent companion piece to the more broadly focused second edition.This book provides complete coverage of the gawk 3.1 language as well as the most up-to-date coverage of the POSIX standard forawk available anywhere. Author Arnold Robbins clearly distinguishes standard awk features from GNU awk(gawk)-specific features, shines light into many of the "dark corners" of the language (areas to watch out for when programming), and devotes two full chapters to example programs. A brand new chapter is devoted to TCP/IP networking with gawk. He includes a summary of how the awk language evolved.The book also covers:
- Internationalization of gawk
- Interfacing to i18n at the awk level
- Two-way pipes
- TCP/IP networking via the two-way pipe interface
- The new PROCINFO array, which provides information about running gawk
- Profiling and pretty-printing awk programs
In addition to covering the awk
language, this book serves as the official "User's Guide" for the GNU implementation of awk
), describing in an integrated fashion the extensions available to the System V Release 4 version of awk
that are also available in gawk
.As the official gawk
User's Guide, this book will also be available electronically, and can be freely copied and distributed under the terms of the Free Software Foundation's Free Documentation License (FDL). A portion of the proceeds from sales of this book will go to the Free Software Foundation to support further development of free and open source software.The third edition of Effective awk Programming
is a GNU Manual and is published by O'Reilly & Associates under the Free Software Foundation's Free Documentation License
(FDL). A portion of the proceeds from the sale of this book is donated to the Free Software Foundation to further development of GNU software. This book is also available in electronic form; you have the freedom to modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.
"Effective awk Programming provides complete coverage of the "gawk 3.1 language as well as the most up-to-date coverage of thePOSIX standard for "awk available anywhere. Author Arnold Robbinsclearly distinguishes standard "awk" features from GNU "awk "(gawk)"-specific features, shines light into many of the "darkcorners" of the language, and devotes two full chapters to exampleprograms. A brand new chapter is devoted to TCP/IP networking with gawk. As the official "User's Guide" for the GNU implementation of "awk ("gawk), it describes in an integrated fashion theextensions available to the System V Release 4 version of "awkthat are also available in "gawk. The book is also availableelectronically, and can be freely copied and distributed under the termsof the Free Software Foundation's Free Documentation License (FDL). Aportion of the proceeds from sales of this book will go to the FreeSoftware Foundation to support further development of free and opensource software.
"Effective AWK Programming" covers every aspect of the AWK 3.0.3 and 3.0.4 language. It offers up-to-date coverage of the POSIX standard for AWK, and distinguishes standard AWK features from GNU AWK-specific features. The author sheds light on "dark corners" of the language, devotes two chapters to example programs, and includes a summary of how the AWK language evolved.
About the Author
Arnold Robbins, an Atlanta native, is a professional programmer and technical author. He has worked with Unix systems since 1980, when he was introduced to a PDP-11 running a version of Sixth Edition Unix. He has been a heavy AWK user since 1987, when he became involved with gawk, the GNU project's version of AWK. As a member of the POSIX 1003.2 balloting group, he helped shape the POSIX standard for AWK. He is currently the maintainer of gawk and its documentation. He is also coauthor of the sixth edition of O'Reilly's Learning the vi Editor. Since late 1997, he and his family have been living happily in Israel.
Table of Contents
Dedication; Foreword; Preface; History of awk and gawk; A Rose by Any Other Name; Using This Book; Typographical Conventions; The GNU Project and This Book; How to Contribute; Acknowledgments; Part I: The awk Language and gawk; Chapter 1: Getting Started with awk; 1.1 How to Run awk Programs; 1.2 Datafiles for the Examples; 1.3 Some Simple Examples; 1.4 An Example with Two Rules; 1.5 A More Complex Example; 1.6 awk Statements Versus Lines; 1.7 Other Features of awk; 1.8 When to Use awk; Chapter 2: Regular Expressions; 2.1 How to Use Regular Expressions; 2.2 Escape Sequences; 2.3 Regular Expression Operators; 2.4 Using Character Lists; 2.5 gawk-Specific Regexp Operators; 2.6 Case Sensitivity in Matching; 2.7 How Much Text Matches?; 2.8 Using Dynamic Regexps; Chapter 3: Reading Input Files; 3.1 How Input Is Split into Records; 3.2 Examining Fields; 3.3 Non-constant Field Numbers; 3.4 Changing the Contents of a Field; 3.5 Specifying How Fields Are Separated; 3.6 Reading Fixed-Width Data; 3.7 Multiple-Line Records; 3.8 Explicit Input with getline; Chapter 4: Printing Output; 4.1 The print Statement; 4.2 Examples of print Statements; 4.3 Output Separators; 4.4 Controlling Numeric Output with print; 4.5 Using printf Statements for Fancier Printing; 4.6 Redirecting Output of print and printf; 4.7 Special Filenames in gawk; 4.8 Closing Input and Output Redirections; Chapter 5: Expressions; 5.1 Constant Expressions; 5.2 Using Regular Expression Constants; 5.3 Variables; 5.4 Conversion of Strings and Numbers; 5.5 Arithmetic Operators; 5.6 String Concatenation; 5.7 Assignment Expressions; 5.8 Increment and Decrement Operators; 5.9 True and False in awk; 5.10 Variable Typing and Comparison Expressions; 5.11 Boolean Expressions; 5.12 Conditional Expressions; 5.13 Function Calls; 5.14 Operator Precedence (How Operators Nest); Chapter 6: Patterns, Actions, and Variables; 6.1 Pattern Elements; 6.2 Using Shell Variables in Programs; 6.3 Actions; 6.4 Control Statements in Actions; 6.5 Built-in Variables; Chapter 7: Arrays in awk; 7.1 Introduction to Arrays; 7.2 Referring to an Array Element; 7.3 Assigning Array Elements; 7.4 Basic Array Example; 7.5 Scanning All Elements of an Array; 7.6 The delete Statement; 7.7 Using Numbers to Subscript Arrays; 7.8 Using Uninitialized Variables as Subscripts; 7.9 Multidimensional Arrays; 7.10 Scanning Multidimensional Arrays; 7.11 Sorting Array Values and Indices with gawk; Chapter 8: Functions; 8.1 Built-in Functions; 8.2 User-Defined Functions; Chapter 9: Internationalization with gawk; 9.1 Internationalization and Localization; 9.2 GNU gettext; 9.3 Internationalizing awk Programs; 9.4 Translating awk Programs; 9.5 A Simple Internationalization Example; 9.6 gawk Can Speak Your Language; Chapter 10: Advanced Features of gawk; 10.1 Allowing Nondecimal Input Data; 10.2 Two-Way Communications with Another Process; 10.3 Using gawk for Network Programming; 10.4 Using gawk with BSD Portals; 10.5 Profiling Your awk Programs; Chapter 11: Running awk and gawk; 11.1 Invoking awk; 11.2 Command-Line Options; 11.3 Other Command-Line Arguments; 11.4 The AWKPATH Environment Variable; 11.5 Obsolete Options and/or Features; 11.6 Known Bugs in gawk; Part II: Using awk and gawk; Chapter 12: A Library of awk Functions; 12.1 Naming Library Function Global Variables; 12.2 General Programming; 12.3 Datafile Management; 12.4 Processing Command-Line Options; 12.5 Reading the User Database; 12.6 Reading the Group Database; Chapter 13: Practical awk Programs; 13.1 Running the Example Programs; 13.2 Reinventing Wheels for Fun and Profit; 13.3 A Grab Bag of awk Programs; Chapter 14: Internetworking with gawk; 14.1 Networking with gawk; 14.2 Some Applications and Techniques; 14.3 Related Links; Part III: Appendixes; Appendix A: The Evolution of the awk Language; A.1 Major Changes Between V7 and SVR3.1; A.2 Changes Between SVR3.1 and SVR4; A.3 Changes Between SVR4 and POSIX awk; A.4 Extensions in the Bell Laboratories awk; A.5 Extensions in gawk Not in POSIX awk; A.6 Major Contributors to gawk; Appendix B: Installing gawk; B.1 The gawk Distribution; B.2 Compiling and Installing gawk on Unix; B.3 Installation on PC Operating Systems; B.4 Reporting Problems and Bugs; B.5 Other Freely Available awk Implementations; Appendix C: Implementation Notes; C.1 Downward Compatibility and Debugging; C.2 Making Additions to gawk; C.3 Adding New Built-in Functions to gawk; C.4 Probable Future Extensions; Appendix D: Basic Programming Concepts; D.1 What a Program Does; D.2 Data Values in a Computer; D.3 Floating-Point Number Caveats; Appendix E: GNU General Public License; E.1 Preamble; E.2 Terms and Conditions for Copying, Distribution, and Modification; E.3 NO WARRANTY; E.4 END OF TERMS AND CONDITIONS; Appendix F: GNU Free Documentation License; F.1 ADDENDUM: How to Use This License for Your Documents; Glossary; Colophon;