Home » Nonfiction » Daniel A. Goldman » Definitive Guide to sed

September 01 , 2009

Definitive Guide to sed

Tutorial and Reference


What is sed?  sed is a "stream editor". sed rapidly and reliably transforms text files, and edits "streams" (program outputs) on the fly. sed is a uniquely useful text processing tool, installed by default on Unix computers. sed can also be used on a Windows PC.

Download epub

Read also

Christmas In Cancun

A sexy, former SEAL and beautiful Mayan anthropologist find more than they bargain for when they team up to complete a decades old family treasure hunt in Cancun. From crystal clear waters to hot, steamy nights, they must work together to escape the danger waiting for them on the Riviera Maya. KaLyn Cooper has penned an exciting, spicy tale of…

Why should I learn sed?  If you write shell scripts, do system administration, or process text files (HTML, source code, data files) with scripts, sed can help make your work more productive and enjoyable.

Why should I buy this book?  "Definitive Guide to sed" is the best way to learn sed. "Definitive Guide" greatly lessens the confusion many encounter on trying to learn sed. The book serves as a full tutorial and reference, useful for both beginning and experienced sed users.

Any prerequisites?  If you plan to use sed on Unix, it is recommended to be familiar with basic Unix commands and to have written some simple shell scripts. If you plan to use sed on Windows, it is recommended to be familiar with batch or PowerShell scripting. sed is not a "beginner's tool".

Which sed is covered?  GNU sed 4.2.1 is covered. If you use a different sed, this book is still useful for learning sed, since most of the commands are the same.

What topics are covered? 

- All sed commands and options
- Regular expressions as used within GNU sed
- Addresses to specify when sed commands are run
- Related Unix text utilities, such as grep, head, and tr
- Example sed scripts with full explanations
- Reference sections for easy lookup

What devices can this e-book version be read on?  The EPUB e-book version is specially formatted for correct display on e-reader devices (Kobo, Nook, Sony) and e-reader software (Adobe Digital Editions, Calibre, iBooks).

– – – – – – – – – -

Top-Level Table of Contents


1: Introduction to sed
2: sed s (substitute) Command
3: Flags for s (substitute) Command

4: Single Character MetaChars
5: Anchor MetaChars
6: Simple Repetition MetaChars
7: General Repetition MetaChars
8: Other RegEx MetaChars
9: SubEx MetaChars

10: Command Addresses

11: Delete PatSpace Content - dD
12: Append, Insert, Change - aic
13: Print PatSpace - pP l
14: Read / Write File - rR wW
15: Read Line into PatSpace - nN
16: Access HoldSpace - hH gG x
17: Branch / Quit - : btT / qQ
18: Other Actions - { } # eyvz =

19: General Advice about sed

20: Examples - Substitution
21: Examples - Line Spacing
22: Examples - Add Some Lines
23: Examples - Print Some Lines
24: Examples - Delete Some Lines
25: Examples - Other Short Tasks
26: Examples - Complex Tasks

27: Related Unix Commands - grep

28: Other Related Commands - 1/2
29: Other Related Commands - 2/2

30: Definitions of Special Terms
31: sed Command Line Reference
32: sed Command Reference
33: s Command Flag Reference
34: Address & Regex Reference
35: Related Books and Web Sites

– – – – – – – – – – – – – – – – -

What the reviewers say:  "I can recommend this book as a good way to learn and review sed. It completely covers GNU sed, with many examples. I hope that this book is well received. The effort put in by the author, and the high quality of the result, surely deserve that." Paolo Bonzini - GNU sed Maintainer 2004-2012

What the reviewers say:  "Definitive Guide to sed" seems like a great way to learn sed. It's a reference / tutorial that's straightforward and to the point. The book has clear descriptions of every sed feature. It's systematic and organized, and written in a flowing style that takes most of the pain out of learning a somewhat complex topic. "Definitive Guide to sed" is highly recommended." Mendel Cooper - Author of 'The Advanced Bash Scripting Guide'

About the author:  Daniel Goldman has been "in the trenches" many years developing software, using sed along with other Unix programs, importing data, writing user guides, and helping users learn. Dan has the desire to help others master and feel comfortable using sed and other Unix utilities.

(Edited on Kobo 05-31-2013)

Show more...

How to download book

Buy this book

You can buy this book now only for $9.85. This is the lowest price for this book.

Buy book

Download book free

If you want to download this book for free, please register, approve your account and get one book for free.


After that you may download book «Definitive Guide to sed»:

Download DOCX:


Download ePub:


Download FB2: