![]()
The book aims to be both a tutorial and a reference manual, offering a clear introduction to AWK programming and the definitive reference for POSIX AWK. Certainly, it is a comprehensive reference source, but its usefulness as a tutorial is problematic. It relies heavily on "forward references", so to speak; that is, features of the language are used before being defined. This would I think make it rather heavy going for an AWK novice. Dale Doherty's book "Sed and Awk", published by O'Reilly, is much better as an introduction for the beginner with AWK.
A strength of the book is the clear distinction made throughout between GAWK and AWK. This is A Good Thing, and makes the book valuable as a reference not only for GAWK, but for any version of AWK. It also provides a clear definition of the POSIX standard for AWK. The final chapter, "The evolution of the awk language", provides useful detail on the differences between the various versions of AWK.
The book does a very good job of explaining the language in full, and goes into plenty of detail on all the important features. In particular, I was pleased to note the emphasis on associative arrays. This is good; associative arrays are one of the great strengths of AWK (and perl!), but are too often given little attention in books about the language.
There are plenty of programming examples, a whole chapter of them; and another chapter with a useful set of library routines. One minor criticism of many of these programs in that they merely, as indeed the author explicitly states in a sub-heading "Reinventing Wheels", reimplementations of some common Unix utilities. This "gee whiz, look what AWK can do" approach is at its worst in section 16.2.2, "An Alarm Clock Program". OK, so you "can do anything in AWK" (just like Perl, huh?), but this is pushing it. A Bourne shell script to do the same thing is only a few lines, and do we really expect many people to use AWK outside a Unix environment? I for one would have preferred more fresh solutions to practical problems, as in the latter half of the chapter. I suppose it could be argued that these programs would be very useful to an AWK user on a "foreign" system, without the useful utilities that a Unix user takes for granted.
On the other hand, there are some very useful programs. the best is an include processor - rather like a simple version of the C preprocessor - implemented in Bourne Shell and AWK. This is a fine program, reminiscent of the climatic chapter of the classic "Software Tools" by Kernighan and Plauger.
Inevitably, the book concentrates throughout on AWK running on a Unix system - many of the more useful examples use /bin/sh, the Bourne shell, for example. An appendix has details about installing and configuring GNU AWK on all the platforms for which it is available - and the list of systems is impressive: gawk is available for Unix, natch; and also for VMS, MSDOS, OS/2, the Atari ST, and the Amiga.
To conclude: this is a very useful book, unmatched as a reference for any AWK - the original "The Awk Programming Language" is now badly outdated - though "Sed and Awk" must still be preferred as a tutorial. If you need an AWK manual, you can not do better than this book.
Effective AWK Programming
Arnold Robbins
SSC
1996
322 pages
£?
Paul Dunne 1996
Copyright © 1995-2007
Paul Dunne,
Sponsored links (requires javascript):