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
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

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

  




 

 

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
       http://www.oreilly.com/catalog/sed2/noframes.html

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 <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) $30.00

-----

       Mastering Regular Expressions, 2d ed., by Jeffrey E. F. Friedl
       (Sebastopol, Calif: O'Reilly and Associates, 2002)
       ISBN 0-596-00289-0
       http://regex.info
       http://www.oreilly.com/catalog/regex2/
       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:

       http://public.yahoo.com/~jfriedl/regex/code.html

-----

       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
       http://www.addison-wesley.de/main/main.asp?page=home/bookdetails&ProductID=37214
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:

       sed-users-subscribe@yahoogroups.com

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

       sed-users-unsubscribe@yahoogroups.com
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:

       http://sed.sourceforge.net/grabbag/tutorials/sed_mcmahon.txt

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

       http://plan9.bell-labs.com/7thEdMan/vol2/sed
       http://cm.bell-labs.com/7thEdMan/vol2/sed

"Do It With Sed", by Carlos Duarte

       http://www.dbnet.ece.ntua.gr/~george/sed/OLD/sedtut_1.html

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

       http://www.grymoire.com/Unix/Sed.html

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

       ftp://ftp.cs.umu.se/pub/pc/u-sedit2.zip
       ftp://ftp.uni-stuttgart.de/pub/systems/msdos/util/unixlike/u-sedit2.zip
       ftp://sunsite.icm.edu.pl/vol/wojsyl/garbo/pc/editor/u-sedit2.zip
       ftp://ftp.sogang.ac.kr/pub/msdos/garbo_pc/editor/u-sedit2.zip

U-SEDIT3.ZIP, by Mike Arst (24 Jan. 1992)

       http://www.student.northpark.edu/pemente/sed/u-sedit3.zip
       CompuServe DTPFORUM, "PC DTP Utilities" library, file SEDDOC.ZIP

Another sed FAQ

       http://www.dreamwvr.com/sed-info/sed-faq.html

sed-tutorial, by Felix von Leitner

       http://www.math.fu-berlin.de/~leitner/sed/tutorial.html

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

       http://ou800doc.caldera.com/SHL_automate/CTOC-Manipulating_text_with_sed.html

"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.

       ftp://ftp.u-aizu.ac.jp/u-aizu/doc/Tech-Report/1997/97-2-007.tar.gz
       available upon request from Lothar Schmitt <lothar@u-aizu.ac.jp>
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
       http://spacsun.rice.edu/FAQ/sed.html
       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.

       http://sed.sourceforge.net/sed1line.txt
       http://www.student.northpark.edu/pemente/sed/sed1line.txt

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

       http://wmaker.lrv.ufsc.br/sed_ptBR.html

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

       http://www.opengroup.org/onlinepubs/007904975/utilities/sed.html

Getting started with sed

       http://www.cs.hmc.edu/tech_docs/qref/sed.html

masm to gas converter

       http://www.delorie.com/djgpp/faq/converting/asm2s-sed.html

mail2html.zip

       http://www.crispen.org/src/#mail2html

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

       http://users.cybercity.dk/~bse26236/batutil/help/SED.HTM

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.

       http://sed.sourceforge.net/grabbag/scripts/dc_overview.htm

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 http://sed.sourceforge.net/sedfaq.html Design by Interspire