Book Review: UNIX awk and sed Programmer's Interactive Workbook
Author: Peter Patsis
Reviewer: Paul Dunne
Despite that mouthful of a title, this is not a book about UNIX. It is about three UNIX utilities, grep, sed and awk, each on their own, one after the other. Now, I learned these tools and others from the classic text, The UNIX Programming Environment by Kernighan and Pike. Although dated in parts, the treatment there crams a good deal of information into a short space and never loses sight of the fact that AWK, sed and similar tools are designed to be used in a UNIX environment, working with the shell and other UNIX tools. Ripping them out of context causes them to seem much less useful than they are. In this book, there is hardly a pipeline in sight. Not only that, we don't even see sed and AWK working together through temporary files. Each tool is considered in complete isolation. There is little point in learning about AWK and sed on their own. If one is really determined to do everything without the shell and other utilities, Perl is a proper superset of the two. AWK and sed come into their own only when considered as part of a toolset.
This book has too much padding. I don't know how many times we are told where the web site associated with the book is, but once would have been enough. I personally hate those little icons popular in books of this sort today. Each time our intrepid author mentions the web, we have a picture of a spider's web (I'm not making this up), each aside or technical tip (I don't really know what to call them—the only clue is the little icon beside each one) has a top hat affixed to it, and so on. I don't know whether this is all IDG's fault, but it was in their “For Dummies” series where I first encountered this style. There, while still objectionable to my mind (and don't get me started on said company referring to customers as “Dummies”!), it is at least well-thought-out and integrated into the book; here, it's just pointless. If I want pictures, I'll go read a comic book.
No mention is made of which AWK or sed or grep. For instance, one might be using GNU awk (gawk), nawk, mawk, MKS awk or any one of several vendor implementations, although hardly the original awk. These things matter. Are we talking strict POSIX sed and AWK here? We are not told. This topic needs to be addressed, however briefly, in any book dealing with these tools.
Is there anything I like about his book? Well, the exercises and self-review questions are frequent and, although often simple, do have the merit of being connected to the preceding subject matter, covering what you are supposed to have learned. They've been given consideration and aren't just tacked on as an afterthought.
This book might be useful for those who find the treatment in Kernighan & Pike too concise; but it needs to be supplemented, if not replaced, by a book which discusses these tools in their proper context. Personally, I find the right thing is just such a dual approach. Rely on a good learner's book, but have at hand a reference work which goes into much greater detail and can be consulted when problems or questions arise. Unfortunately, this book is neither. For instance, there is an “Awk, sed and grep” reference listed as an appendix. Turning to the appendices, we find a rather sparse reference for AWK only, with no mention of the other two.
It isn't that this is a bad book for what it does. However, what it does isn't enough and is aimed at the wrong market. The cover proclaims, “Perfect for first-time and intermediate UNIX programmers alike”. Very little is contained here for either first-time or intermediate UNIX programmers or users. It would be better suited to a Windows user who has the Cygnus Win32 toolkit and wants to know what to do with it. Even then, some coverage of the shell is almost essential. Realistically, the people who want a Win32 environment to look like UNIX are going to be people with UNIX experience, and this book is not for them. So what is the market? Well, that's the biggest problem with this book. Within its rather narrow remit, it does things well; but it doesn't have a well-defined audience. If you need to learn about sed and AWK, then the best resources remain Kernighan & Pike and O'Reilly's UNIX Power Tools.
I find it hard to recommend this book to anyone. It might possibly be useful, if supplemented by a general work on using the shell, for those who need a slow and easy introduction to sed and AWK.
Paul Dunne (firstname.lastname@example.org) is an Irish writer and consultant who specalises in Linux. The only deadline he has ever met was the one for his very first article. His home page is at http:dunne.home.dhs.org/
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- The Ubuntu Conspiracy
- Science on Android
- A First Look at IBM's New Linux Servers
- Vigilante Malware
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- Vagrant Simplified
- Bluetooth Hacks
- System Status as SMS Text Messages
- Libreboot on an X60, Part I: the Setup
- October 2015 Issue of Linux Journal: Raspberry Pi