sed & awk, Second Edition
By Dale Dougherty, Arnold Robbins
March 1997
Pages: 432
ISBN 10: 1-56592-225-5 |
ISBN 13: 9781565922259




(4) (Average of 5 Customer Reviews)


Description
sed & awk describes two text manipulation programs that are mainstays of the UNIX programmer's toolbox. This edition covers the sed and awk programs as they are mandated by the POSIX standard and includes discussion of the GNU versions of these programs.
Full Description
sed & awk describes two text processing programs that are mainstays of the UNIX programmer's toolbox.
sed is a "stream editor" for editing streams of text that might be too large to edit as a single file, or that might be generated on the fly as part of a larger data processing step. The most common operation done with sed is substitution, replacing one block of text with another.
awk is a complete programming language. Unlike many conventional languages, awk is "data driven" -- you specify what kind of data you are interested in and the operations to be performed when that data is found. awk does many things for you, including automatically opening and closing data files, reading records, breaking the records up into fields, and counting the records. While awk provides the features of most conventional programming languages, it also includes some unconventional features, such as extended regular expression matching and associative arrays. sed & awk describes both programs in detail and includes a chapter of example sed and awk scripts.
This edition covers features of sed and awk that are mandated by the POSIX standard. This most notably affects awk, where POSIX standardized a new variable, CONVFMT, and new functions, toupper() and tolower(). The CONVFMT variable specifies the conversion format to use when converting numbers to strings (awk used to use OFMT for this purpose). The toupper() and tolower() functions each take a (presumably mixed case) string argument and return a new version of the string with all letters translated to the corresponding case.
In addition, this edition covers GNU sed, newly available since the first edition. It also updates the first edition coverage of Bell Labs nawk and GNU awk (gawk), covers mawk, an additional freely available implementation of awk, and briefly discusses three commercial versions of awk, MKS awk, Thompson Automation awk (tawk), and Videosoft (VSAwk).
Featured customer reviews

sed & awk, 2nd Edition Review,
September 28 2002
Submitted by leon
[
Respond |
View]
I loved this book. Very well and clear written. I downloaded examples from oreilly site and was able to play with it through the reading. Not much theory plenty of examples, so you can see how everything works "in real life. I highly recommend this book, especially for beginners.
sed & awk, 2nd Edition Review,
April 21 2001
Submitted by MML VERMA
[
Respond |
View]
Excellent book for anyone interacting with UNIX or awk !
sed & awk, 2nd Edition Review,
April 05 2001
Submitted by Stein B. Sylvarnes
[
Respond |
View]
This is a difficult book to review and rate. I gave it a 4, but from another point of view, it deserves a 2. More on this later. If you look at the other reviews, they differ widely. But let's get on with the review shall we? I divide it into four sections. First an overview, then I consentrate on sed and awk. Finally I'll sum it all up.
Overview
This book start with introducing sed, gradually increasing difficulty. Then it go back to basics with awk. Awk is covered more in-depth than sed, becuse it is a bigger language. The appendices contain real-world examples of sed and awk programs, some of which I use today. It allso have a good refernce section, as it should.
This book generally focus on writings and typesetting, but extraction of information and report generating is allso covered. Overall I find that it cover most of my uses with these tools.
Sed
The sed-part begin nicely with a general intro to sed and regexps, and explain the difference between sed and ed. As I said earlier, it gradually increases in difficulty and usability. In the end you are able to advnced multiline search-and-replace, format touchups and much more.
Awk
As I said, Awk is covered more in-depth than sed. But allso this part begin with the basics, assuming no prior knowledge to awk. It do, however asume some knowledge with regexps, as that was covered in the sed section. It show you interaction with shell-scripts, as well as all the usual features in text manipulation. It is interesting to note that the authors have chosen to use 'old' awk as much as possible to ensure their examples will work on as many platforms as possible. They do, however poiont out when another awk, like nawk or gawk, can do the job more efficiently. They have allso used an entire chapter discussing the differences between the different awks. The last chapter discuss a rather large real-world example used when typesetting this book very in-depth. And in the appendices there are many useful awk-scripts.
Summary
All in all a good book. I particularly liked the awk section. The sed section was a bit terse for me in the beginning. But what can you expect, a young cub like me don't know how it was done in the good ol'days. The focus in this book is on typesetting. Not nesecerily bad, but my use of sed and awk is mainly report extraction and, to a lesser degree presentation.
As I said in the beginning, I might as well hve given this book a '2'. Here's why; This book focus on beginners to intermediate users. So their text and examples should reflect that. Their intermediate examples do, however, tend to be a bit too difficult if you skip on the first chapters, especially in the sed aprt. Again, not nesecerily bad, it might even be intentional from the authors; You can't move on until you have a firm grip on the basics. So if I was looking for a book to jump-start me into being an intermediate sed&awk programmer, I'd definately give this book a '2'.
I do recommend this book to anyone interested in a basic and thurough introduction to sed&awk. Mastering this book will let you do most things these languages were written to do
Read all reviews
sed & awk, 2nd Edition Review,
February 05 2001
Submitted by Fabio Rotondo
[
Respond |
View]
This book rocks. It has a deep coverage of the two tools in the title, but it is
also a very valuable reference for
regular expressions. I already knew and used both
sed and
awk before reading this book, but it pointed
me out so many new solutions and ideas I couldn't imagine at all.
The part I liked more was
sed section. I always considered sed like a small yet handy tool, but after I have read
sed & awk I was able to exploit all sed's power.
I read this book almost one year ago, but I still use it, and everytime I open it, I learn something more.
Great book.
sed & awk, 2nd Edition Review,
December 08 2000
Submitted by Chris Bidmead
[
Respond |
View]
Not one of O'Reilly's better books, IMHO.
I think the essential problem is bundling together
awk and
sed, two philosophically very different tools. The result seems to be a book that is bitty, has no clear narrative line, with arbitrarily chosen examples that seem to be hard to track down when you're trying to use the book for reference. What I mean by that, I think, is that although the detailed discussions are useful and instructive if the problem you're trying to solve is a close match to an example focussed in the book, it's not at all easy to derive general principles, or extrapolate from the rather narrow selection of cases under consideration.
The problems inherent in writing a book about
awk (and
gawk, and
nawk...) are a difficult enough hurdle by themselves. The addition of
sed was a language too far. And heaven's knows,
sed -- an indispensible tool, but a formidably difficult one for beginners and cognoscenti alike -- surely deserves a book on its own.
The O'Reilly UNIX books set a very high standard. I'm sorry to say I don't think this one quite makes the grade.
el bid
sed & awk, 2nd Edition Review,
January 02 1999
Submitted by Steve Revilak, Boston, MA
[
Respond |
View]
Sed and awk are classic examples of tools that, on one level, provide a simple means for accomplishing basic tasks, while on a deeper level have complex, powerful, and versatile feature sets. Their base concepts can quickly be understood by beginners, while one could spend years learning all the intracies they programs have to offer. This book is good in that it covers both areas. As an introductory text, the novice is walked through basic operations, introduced to regular expressions, etc. in a comprehensible step-by-step fashion. For experienced users, it offers a handy reference for those functions you don't use every day, but sure come in handy when you need them. For intermediates, it presents a solid review and plenty of new territory to cover. Excellent book! I reccomend it highly.
Media reviews
"Those who need or want to do heavy amounts of text and file processing might want to check out 'sed & awk, 2nd Edition.'"
--Dee-Ann LeBlanc, LinuxPlanet, August 2002
"The Enlightened Ones say that you should never use C if you can do it with a script, never use a script if you can do it with awk, never use awk if you can do it with sed, and never use sed if you can do it with grep. Why? "What's the next Big Technology that corporates really "gotta have"? No, I'm sorry, firewalls are passe and extranets are really nothing new. The big thing is data warehousing. And if you manage to put together a data warehouse? Then, you have to have data mining. This, you can do with grep. (Grep actually gets little space in the book, but it is a good introduction to sed and awk.) "So what's the Big Problem these days? Easy answer. Year 2000, that's right. Which means you have to take all your two-digit-year data fields, and make them four-digit-year data fields. You can do that with sed. True, you still have to check and modify all your programming, but sed could help you there, too. (And, if you were using the proper tools, you wouldn't have two million lines of code to go through.) "And what have the Big Software Companies been telling you to buy for the last fifteen to twenty years? Fourth generation languages. For all the arguing over them, what are 4GLs? Report writers. They read data, find appropriate data, and format it in a way that doesn't strain our carbon-based logic units. Sounds a lot like awk. "So, this book will tell you how to handle the latest Big Technology, Big Problem, and Big Software." (Now, aren't you sorry you don't use UNIX?) --copyright Robert M. Slade, 1997 BKSEDAWK.RVW 970706
Read all reviews