xorl %eax, %eax

Book: sed & awk (2nd Edition)

leave a comment »

This is one of those classic O’Reilly books that most UNIX people have read numerous times since November 1990 when the first edition was published. The second (and still latest) edition was released in March 1997. I’m writing this review because I have recently purchased a new copy of this book and I was truly excited when I realized that this is a brand new, January 2011 printing of the second edition.

Title: sed & awk
Author: Dale Dougherty & Arnold Robbins

Chapter 1: Power Tools for Editing
In this first chapter, authors introduce the importance of such “power tools” and declare the aims of this book. Here you can also find some general information for both sed and awk utilities. Although the first chapters include some very introductory information, the main goal of this book is to master the details of these UNIX utilities.

Chapter 2: Understanding Basic Operations
Beginning with the all time classic line editor ed, the authors introduce the creation of tools with ed’s functionality. Those tools begin with the separate regular expression utility known as grep (which stands for Global Regular Expression Print) and uses the ed style arguments. Similar to this is the sed (standing for Stream EDitor) that performs operations identical to ed but on streams. This introduction ends up with AWK scripting language that was influenced by the latter utilities in the late 70s. The chapter continues with various basic operations with the aforementioned ed derivatives.

Chapter 3: Understanding Regular Expression Syntax
As you have probably guessed from the chapter’s title, this one is simply an introduction to regular expressions. This means everything from understanding the theory behind regular expressions as well as the meta-characters being used to providing examples and sample regular expressions for various different scenarios. It is a small chapter with everything you need to know to get started with regular expressions.

Chapter 4: Writing sed Scripts
Pretty self-explanatory. This chapter is about writing scripts using sed utility. Starting with the basics like simply putting commands in a script to more advanced topics.

Chapter 5: Basic sed Commands
Continuing from the previous chapter, this one goes through sed’s basic commands. It discusses everything from substitution and append up to transformations and using files.

Chapter 6: Advanced sed Commands
After addressing all the essentials to understand sed in the previous two chapters, this one moves to the more advanced concepts such as multi-line patterns, flow control commands, etc.

Chapter 7: Writing Scripts for awk
Simlar to the sed’s chapters structure, this one starts of by identifying the general idea behind scripting using AWK. It goes through the basics of this scripting language’s model and syntax up to variables, boolean operations, parameter passing and other programming concepts.

Chapter 8: Conditionals, Loops and Arrays
Moving to the 8th chapter, we have the various conditions such as ‘if’ statement, loops such as ‘while’, ‘do while’ and ‘for’ loops as well as arrays.

Chapter 9: Functions
Once again, the title is very self-explanatory. Here you can find information on how to write and use functions in your AWK scripts.

Chapter 10: The Bottom Drawer
In this chapter, the authors put everything that simply did not fit in the other chapters. This means slightly unrelated subjects like reading/writing to files and pipes, various functions such as close(), system(), getline(), etc. menus, limitations and of course many examples for each case.

Chapter 11: A Flock of awks
So far, the chapters were dealing specifically with the POSIX compatible AWK. Here authors go through the differences and details of the various AWK implementations.

Chapter 12: Full-Featured Applications
This is a collection of example AWK scripts that perform a specific operation. Here you can find information on how to write an interactive spelling checker, generating a formatted index as well as numerous scripting tips.

Chapter 13: A Miscellany of Scripts
The last chapter of this book is a collection of ten fully operational scripts to study varying in complexity from basic to advanced.

First of all, I like both sed and awk and consuquently my opinion is biased. It is an excellent book and has many advantages such as the countless examples, the small chapters which are very easy to follow and well written, the approach of discussing both the theory and the practice behind each subject, etc. I would definitely suggest this book to anyone using these tools.

Written by xorl

June 5, 2011 at 21:44

Posted in books

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s