REVIEW - sed and awk


sed and awk


Dale Dougherty&Arnold Robbins




O'Reilly ()




Dave Rutlidge


December 1999



It's almost worth buying for the explanation of regular expressions alone.

For the benefit of those who are unfamiliar with unix tools, sed and awk are two of the most powerful and most versatile tools that unix offers. Sed is a stream editor and can be used to apply a series of edits to a number of files, or the stdout of a program. Awk is a powerful interpreted programming language that provides extensive text processing facilities and is ideal for producing reports and restructuring data. While both sed and awk were born in a unix environment, they have been ported to a variety of platforms and are frequently available in freeware as well as commercial packages.

Both sed and awk make extensive use of regular expressions (RE) and pattern matching. While simple in concept, RE can be a nightmare for anyone encountering them for the first time. This book provides one of the best discussions of RE I have seen. It is gentle in its approach, but very comprehensive and includes a table of 'common' (if you are an American) RE, some of which are actually useful. While the book is specifically devoted to sed and awk, the author makes reference to some of the other tools that also use RE, such as vi, grep and egrep and shows how the expression syntax varies between programs.

The book then breaks off into a more detailed discussion of sed, then awk. Once again the approach is gently but through and few readers would have difficulty following it. The code examples are clear and well structured and vary from (sometimes very) trivial examples to demonstrate a point to more extensive 'real-world' example code. There is no code disc, but the code is available on- line in a variety of ways, although not via a web page. There are no review questions or exercises to test the readers understanding.

While the book is based upon the POSIX standard versions of sed and awk, some discussion of other versions is included. Specifically, there is a whole chapter devoted to the different flavours of awk that are available.

The book concludes with quick reference sections for both sed and awk and a complete listing of the two more extensive applications developed as the book progressed. It is well indexed and very useable. Like all O'Reilly's books the binding is excellent and the book will easily lay flat by your keyboard.

Overall, the book is well written and has a very readable style. It forms good starting point for anyone who wishes to explore these interesting and extremely powerful tools and a useful reference guide for the slightly more experienced. It's almost worth buying for the explanation of regular expressions alone.

Book cover image courtesy of Open Library.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.