Home > sed

sed - the stream editor

sed . . . the stream editor

Originally written and designed for Unix, sed has been ported to MS-DOS, Windows, OS/2, and other operating systems. Sed is a non-interactive editor that works from a command line; it"s not a GUI Windows app. Sed changes blocks of text on the fly, without making you open up a screen, push a cursor around, and press DELETE or INSERT or ENTER or function keys.

"Hey," you might ask. "All word processors have a find-and-replace feature."

Not like this. Sed is extremely powerful, and you can do things in sed that you can"t do in any standard word processor. And because sed is external to the word processor and comes with every Unix system in the world, once you learn sed you"ll have a very handy tool in your toolkit, even if (like me) you rarely use Unix.

How it works: You feed sed a script of editing commands (like, "change every line that begins with a colon to such-and-such") and sed sends your revised text to the screen. To save the revisions on disk, use the redirection arrow, > newfile.txt . Sample syntax:

    sed "one-or-two-sed-commands" input.file >newfile.txt     sed -f bigger_sed.script input.file >newfile.txt    

This page is an attempt to collect my FAQ (Frequently Asked Questions) files and my favorite sed utilities and introductions for novices. The text files are for any sed user; the binaries are for DOS/Windows users.


  • sedsed — a sed debugger written in Python
  • sd.ksh — a sed debugger written in ksh

Obviously, you have to have access to Python and/or a genuine ksh (Korn shell) to run these debuggers. If I ever get a round tuit, I will write a mini-tutorial on using each of these. <smile>

sed docs by Eric Pement
various sed websites

popular sed binaries for MS-DOS

All of these versions will run in a DOS window or in a full-screen DOS session under Microsoft Windows.

A Table of Differences among DOS versions of SED
This version of sed supports . . . . ssed gsed407 gsed302.80 gsed302 gsed205 gsed103 csed sed15 sedmod bsed
Win9x long filenames Y Y Y Y Y Y 0 N ? 0
newlines in s/find/rep/ replacement text via \n Y Y N N Y Y Y Y
represent tabs by \t Y Y N N Y Y Y Y 0
"a append-on-same-line" (for a,i,c commands) Y Y N N N Y Y N
interval expressions like \{ m,n \} Y Y Y Y N Y 0 N Y
ignore case /flag/ i or switch ( -i ) Y Y Y N N N Y N
hex code entry via \x HH Y Y N N Y Y N N
unlimited line length or buffer size Y Y Y Y 04K 0K 0K
numeric argument flags in s/ubsti/tution/ 0 Y Y Y Y Y Y N
OR searches with \| , like / this \| or \| this / Y Y Y Y Y N N N
periodic line matching with M~N Y Y Y Y N N N N
word arguments with $1, $2, ... $8, $9 N N N N N N Y
case change with \L, \l, \U, \u, \E, \e Y N N N N N Y N
can run in MS-DOS mode, fully outside of Windows N Y Y N N Y 0 Y

0 File SED15X.ZIP does not support Win95 long filenames. However, a version of SED15.EXE compiled with Mingw32 does support long filenames and is available here .
0 Berkeley sed docs say that it supports Windows Long Filenames, but it doesn"t work under Windows 0000. Not yet tested under Win9x.
0 Yes, but only substitutes TAB for \t on the "find" portion, not on the "replace" portion of a s/ubsti/tution/. Undocumented.
0 Interval range of \{0, n \} not supported in sed15.
0 sed15 will run in MS-DOS mode; the version compiled with Mingw32 will not.

mailing list for sed users

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 , moderated by Aurelio Marinho Jargas. The average volume of mail for sed-users is about 00 messages a week.

related batch editing files
Console/command-line apps Windows apps

This section has been revised, to remove programs that don"t work that well and to recommend better things in their place. If you find things that work better for you, drop me a line to show me your discoveries.

Thanks for visiting. Hope you found what you wanted!

Eric Pement , sed FAQ maintainer
home page: http://www.student.northpark.edu/pemente/

Last modified: 04 Jan 0004, 05:00:04

qvd.ultra-shop.homelinux.org vv.mega-market.dynu.com ahg.ultra-shop.homelinux.org i3p.19qw.ml 2nr.19-qw.ga mh4.19-qw.ga j5h.19qw.ga so4.19qw.ml e4q.19-qw.tk 2b7.19-qw.ml 1hp.19qw.gq 1im.19qw.cf bol.19-qw.tk mct.19-qw.cf 1cj.19-qw.ga mff.19qw.tk qgw.19qw.ga 1zx.19qw.ml jz3.19qw.gq etb.19qw.gq e3e.19-qw.gq j41.19qw.ga 4ir.19qw.cf ucg.19-qw.ml главная rss sitemap html link