2.3. Where can I learn to use sed?
Sed & Awk, 2d edition, by Dale Dougherty & Arnold Robbins
(Sebastopol, Calif: O'Reilly and Associates, 1997)
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
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
<http://www.cs.colostate.edu/~dzubera/sedawk.txt>, and errors in
the 2nd are at <http://www.cs.colostate.edu/~dzubera/sedawk2.txt>,
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)
Mastering Regular Expressions, 2d ed., by Jeffrey E. F. Friedl
(Sebastopol, Calif: O'Reilly and Associates, 2002)
http://public.yahoo.com/~jfriedl/regex/ (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
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: http://br.groups.yahoo.com/group/sed-br/
sed-users mailing list: http://groups.yahoo.com/group/sed-users/
To subscribe to sed-users, send a blank message to:
To unsubscribe from sed-users, send a blank message to:
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@example.com>
2.3.4. General web and ftp sites
http://sed.sourceforge.net/grabbag # Collected scripts
http://main.rtfiber.com.tw/~changyj/sed/ # Yao-Jen Chang
http://www.math.fu-berlin.de/~guckes/sed/ # Sven Guckes
http://www.math.fu-berlin.de/~leitner/sed/ # Felix von Leitner
http://www.dbnet.ece.ntua.gr/~george/sed/ # Yiorgos Adamopoulos
http://www.student.northpark.edu/pemente/sed/ # Eric Pement
ftp://algos.inesc.pt/pub/users/cdua/scripts.tar.gz (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.