AWK Pocket Reference
AWK has lived in every Unix for nearly half a century. Aho, Weinberger, and Kernighan built it at Bell Labs in 1977 to solve a permanent problem — structured text processing — with a minimal, composable design, and that design is why it endures. This pocket reference covers GNU AWK (gawk) with compatibility notes for macOS/BSD: records and fields, pattern–action programs, regular expressions, arrays, built-in and user-defined functions, output redirection and pipes, GNU extensions, debugging, locale, and the one-liners you will keep reaching for. Includes a cheat sheet, a quick reference card, and a task index for jobs you have not done yet but will.
Table of Contents
- 1 The AWK Model
- 2 Records and Fields
- 3 Patterns
- 4 Actions and Statements
- 5 Variables and Expressions
- 6 Regular Expressions
- 7 Arrays
- 8 Built-in Functions
- 9 Output Redirection and Pipes
- 10 AWK Programs in Files
- 11 User-Defined Functions
- 12 Error Handling and Defensive AWK
- 13 Practical Recipes
- 14 GNU AWK Extensions
- 15 Debugging and Profiling
- 16 Idioms and Patterns
- 17 Locale and Encoding
- 18 Gotchas and Edge Cases
- 19 AWK vs Other Tools
- 20 Cross-Platform Compatibility
- A One-Liner Cheat Sheet
- B Quick Reference Card
- C Task Index