sed and awk are tools used by users, programmers, and administrators, sed, so called because it is a stream editor, is perfect for applying a series of edits to a number of files. awk, named after its developers, Aho, Weinberger, and Kernighan, is a programming language that lets you manipulate structured data easily and generate formatted reports. This second edition covers awk as described by the POSIX standard, as well as a number of both freely available and commercial versions of awk.
The book begins with an overview and a tutorial that demonstrate a progression in functionality from grep to sed to awk. sed and awk share a similar command-line syntax, accepting user instructions in the form of a script. Because all three programs use UNIX regular expressions, an entire chapter is devoted to understanding UNIX regular expression syntax. Next, the book describes how to write sed scripts.
After getting started by writing a few simple scripts, you'll learn other basic commands that parallel manual editing actions, as well as advanced commands that introduce simple programming constructs. Among the advanced commands are those that manipulate the hold space, a set-aside temporary buffer. The second part of the book has been extensively revised to include POSIX awk as well as coverage of three freely available and three commercial versions of awk.
The book introduces the primary features of the awk language and how to write simple scripts. You'll also learn: Common programming constructs; How to use awes built-in functions; How to write user-defined functions; Debugging techniques for awk programs; How to develop an application that processes an index, demonstrating much of the power of awk; FTP and contact information for obtaining various versions of awk.
Also included is a miscellany of user-contributed scripts that demonstrate a wide range of sed and awk scripting styles and techniques.