Four Hurdles to Mastering sed and awk
There are a number of introductory UNIX books that will acquaint you with sed and awk. The goal of this book is to take you much further—to help you master sed and awk and to reduce the amount of time and effort that it takes you to reach that goal.
There are four hurdles on the way to mastering sed and awk. You must learn:
How to use sed and awk. This is a relatively low hurdle to clear because, fortunately, sed and awk work in a very similar manner, based on the line editor ed. Chapter 2, covers the mechanics of using sed and awk.
To apply UNIX regular expression syntax. Using UNIX regular expression syntax for pattern matching is common to both sed and awk, and many other UNIX programs. This can be a difficult hurdle for two reasons: the syntax is arcane, and though many people have some experience using regular expressions, few have persevered to master the complete syntax. The more facile you are in using this syntax, the easier sed and awk are to use. That is why we spend a good deal of time covering regular expressions in Chapter 3.
How to interact with the shell. While not directly related to sed and awk themselves, managing the interaction with the command shell is often a frustrating problem, since the shell shares a number of special characters with both programs. If you can, avoid the problem by putting your script in a separate file. If not, use a Bourne-compatible shell for your scripts (the quoting rules are more straightforward), ...