Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




The sed FAQ
Prev Home Next

2.3. Where can I learn to use sed?

2.3.1. Books
       Sed & Awk, 2d edition, by Dale Dougherty & Arnold Robbins
       (Sebastopol, Calif: O'Reilly and Associates, 1997)
       ISBN 1-56592-225-5

About 40 percent of this book is devoted to sed, and maybe 50 percent is devoted to awk. The other 10 percent covers regexes and concepts common to both tools. If you prefer hard copy, this is definitely the best single place to learn to use sed, including its advanced features.

The first edition is also very useful. Several typos crept into the first printing of the first edition (though if you follow the tutorials closely, you'll recognize them right away). A list of errors from the first printing of sed & awk is available at <>, and errors in the 2nd are at <>, though most of these were corrected in later printings. The second edition tells how POSIX standards have affected these tools and covers the popular GNU versions of sed and awk. Price is about (US) $30.00


       Mastering Regular Expressions, 2d ed., by Jeffrey E. F. Friedl
       (Sebastopol, Calif: O'Reilly and Associates, 2002)
       ISBN 0-596-00289-0 (for the first edition)

Knowing how to use "regular expressions" is essential to effective use of most Unix tools. This book focuses on how regular expressions can be best implemented in utilities such as perl, vi, emacs, and awk, but also touches on sed as well. Friedl's home page (above) gives links to other sites which help students learn to master regular expressions. His site also gives a Perl script for determining a syntactically valid e-mail address, using regexes:


       Awk und Sed, by Helmut Herold.
       (Bonn: Addison-Wesley, 1994; 288 pages)
       2nd edition to be released in March 2003
       ISBN 3-8273-2094-1
2.3.2. Mailing list

If you are interested in learning more about sed (its syntax, using regular expressions, etc.) you are welcome to subscribe to a sed-oriented mailing list. In fact, there are two mailing lists about sed: one in English named "sed-users", moderated by Sven Guckes; and one in Portuguese named "sed-BR" (for sed-Brazil), moderated by Aurelio Marinho Jargas. The average volume of mail for "sed-users" is about 35 messages a week; the average volume of mail for "sed-BR" is about 15 messages a week.

       sed-BR mailing list:
       sed-users mailing list:

To subscribe to sed-users, send a blank message to:

       [email protected]

To unsubscribe from sed-users, send a blank message to:

       [email protected]
2.3.3. Tutorials, electronic text

The original users manual for sed, by Lee E. McMahon, from the 7th edition UNIX Manual (1978), with the classic "Kubla Khan" example and tutorial, in formatted text format:

The source code to the preceding manual. Use "troff -ms sed" to print this file properly:

"Do It With Sed", by Carlos Duarte

"Sed: How to use sed, a special editor for modifying files automatically", by Bruce Barnett and General Electric Company

U-SEDIT2.ZIP, by Mike Arst (16 June 1990)

U-SEDIT3.ZIP, by Mike Arst (24 Jan. 1992)
       CompuServe DTPFORUM, "PC DTP Utilities" library, file SEDDOC.ZIP

Another sed FAQ

sed-tutorial, by Felix von Leitner

"Manipulating text with sed," chapter 14 of the SCO OpenServer "Operating System Users Guide"

"Combining the Bourne-shell, sed and awk in the UNIX environment for language analysis," by Lothar Schmitt and Kiel Christianson. This basic tutorial on the Bourne shell, sed and awk downloads as a 71-page PostScript file (compressed to 290K with gzip). You may need to navigate down from the root to get the file.
       available upon request from Lothar Schmitt <[email protected]>
2.3.4. General web and ftp sites             # Collected scripts       # Yao-Jen Chang      # Sven Guckes     # Felix von Leitner      # Yiorgos Adamopoulos  # Eric Pement (sed and shell scripts)

"Handy One-Liners For Sed", compiled by Eric Pement. A large list of 1-line sed commands which can be executed from the command line.

"Handy One-Liners For Sed", translated to Portuguese

The Single UNIX Specification, Version 3 (technical man page)

Getting started with sed

masm to gas converter

sample uses of sed in batch files and scripts (Benny Pederson)

dc.sed - the most complex and impressive sed script ever written. This sed script by Greg Ubben emulates the Unix dc (desk calculator), including base conversion, exponentiation, square roots, and much more.

If you should find other tutorials or scripts that should be added to this document, please forward the URLs to the FAQ maintainer.

The sed FAQ
Prev Home Next

   Reprinted courtesy of Eric Pement. Also available at Design by Interspire