The Sed Programming Langauge

Click below to go directly to a specific section:
History | Significant Language Features | Areas of Application
Sample Programs | References


Sed was first written in 1977 as a stream adaptation of the ed editor and was released in Version 7 AT&T UNIX. Since that time it has been a staple in UN*X distributions. There have been no significant modifications to sed since its original release. Due to its simple yet powerful nature it quickly became an important tool of system administrators. However, since the advent of perl, use of sed has decreased dramatically. It has dropped so much, in fact, that it is questionable whether it will survive much longer as a useful tool and not merely a curious legacy program of UN*X's early days. While at one time sed was widely available, it is becoming harder and harder to find source code and/or executables.

Significant Language Features

The sole purpose of sed was to expedite the editing of text. Whether that text was the output of another program or simply a file it does not matter. Sed is capable of highly complex multi-line pattern matching and subsitution. A far cry from today's simple search and replace editing features, sed can easily understand complex patterns and make changes to specific portions of them. A dream for programmers and authors in a day when teletype terminals were still more common then CRT based terminals. It even has branching commands to allow scripts to branch to other areas of the script depending on what has passed through the buffer.

Areas of Application

Originally used extensively with awk it now has three main uses:

  1. To edit files too large for comfortable interactive editing.
  2. To edit any size file when the sequence of editing commands is too complicated to be comfortably typed in interactive mode.
  3. To perform multiple `global' editing functions efficiently in one pass through the input.

Sample Programs


[Prev] [Home] [Next]

Last update 3-09-99
This page has been accessed