sed & awk

By Dale Dougherty
January 1900
Pages: 414
ISBN 10: 0-937175-59-5 | ISBN 13: 9780937175590

This book has been updated—the edition you're requesting is OUT OF PRINT. Please visit the catalog page of the latest edition.

The latest edition is also available on Safari Books Online.

Book description

For people who create and modify text files, sed and awk are power tools for editing. Most of the things that you can do with these programs can be done interactively with a text editor; however, using sed and awk can save many hours of repetitive work in achieving the same result.
Full Description

For people who create and modify text files, sed and awk are power tools for editing. Most of the things that you can do with these programs can be done interactively with a text editor. However, using sed and awk can save many hours of repetitive work in achieving the same result. To master sed and awk you must thoroughly understand UNIX regular expressions, and understand the syntax of sed and awk commands. This handbook treats regular expressions as a foundation for learning about sed and awk and contains a comprehensive treatment of sed and awk syntax. It emphasizes the kinds of practical problems that sed and awk can help users to solve, with many useful example scripts and programs. Contents include:
  • A tutorial showing basic operations of sed and awk
  • Regular expression syntax and examples
  • Basic and advanced sed commands
  • Features of awk (plus gawk and nawk)
  • Common programming constructs
  • Advanced topics
  • User-contributed scripts
Post-purchase benefits:

Register your book | Submit Errata | Examples


Browse within this book

Cover | Table of Contents | Index | Colophon

Book details

First Edition: January 1900
ISBN: 0-937175-59-5
Pages: 414


Featured customer reviews

Be the first person to review this book!

Write a Review


Media reviews

"Most scripts written by system administrators to run UNIX systems involve sed. You can't really administer the system adequately if you can't read system scripts, so just learning how to read sed will help you understand vital system scripts like rc.

"Since understanding system scripts is so important for system administrators, you would think that there would be more books on sed, but there are only bits and pieces in a few books. [T]here has never been a book that gave sed more than a few pages. As for that, how many books have you ever seen on awk aside from a small volume called the AWK Programming Language by Aho, Kernighan and Weinberger? System administrators frequently use awk. Since awk is a pattern-matching language, it is perfect for applications requiring filtering with programming constructs.

"So where can system administrators turn to find the information they need on important topics like awk and sed?

"Once again O'Reilly and Associates shows its senstitivity to the needs of UNIX system administrators with an excellent new book authored by Dale Dougherty entitled sed & awk. I have read many UNIX and C books that not only have been easy to put down, it required a lot of discipline to pick them up and continue plowing through them, but I found sed & awk fascinating and compelling. I have been using and teaching both sed and awk for a decade and never knew the full extent of their powers until I read this fine Nutshell book.

"Dougherty takes a spiral approach to teaching, laying down a solid foundation of background material before hitting the reader with sed and
awk. Since awk and sed are dependent on regular expressions, Dougherty starts off with a comprehensive review of regular expressions. Then he goes into the editors (ed, vi, and ex), for there is no sense in even studying sed and awk until you have a firm grip on the editors. He shows you how to use regular expressions in editors to accomplish useful work, such as doing searches and replaces. Only after spending at least 50 pages on editors and regular expressions does Dougherty tackle sed and awk.

"Once into sed, the fun really starts, for what Dougherty does with sed is amazing. He takes formatted manual pages and reverse-engineers them back into troff-ready text with multiple-line sed programs. In day-to-day use, system administrators don't usually use sed in lengthy programs, and seeing them in this fashion alters your thinking and forces you to treat sed with increased respect.

"I won't spoil your enjoyment of this remarkable book by telling you more except to say that it gets better from there. Suffice to say that awk is covered with equal thoroughness.

"Dougherty obviously enjoys what he's writing about, and his excitement about the subject draws you in. His master of the subject makes you feel comfortable with even the most complex sed scripts, and as you read the explanations, you feel confident enough to try your hand at them, too. The sed and awk utilities have been extended through the years, such as a new awk called nawk, and this book even covers those extensions.

"sed & awk is a must for UNIX system programmers and administrators, and even general UNIX readers will benefit. I have over a hundred UNIX and C books in my personal library at home, but only a dozen are duplicated on the shelf where I work. This one just became number twelve." --Root Journal, January/February 1991

Hide extended reviews


See larger cover