The sed stream editor

The sed program is an interpreter for sed, the stream editor, a simple data-driven programming language that accepts data on input (normally strings), and acts on and transforms it conditionally. The programs end up being very short, as the commands are all only one letter long. This terse approach means they fit very well on a command line and are quick to type.

We'll use the following example file, named manual, for our sed demonstration:

$ cat manual
The sed utility is a stream editor that shall read one or more text files,
make editing changes according to a script of editing commands,
and write the results to standard output.

With an empty program, sed simply reproduces all of the output without changing it; this ...

Get Bash Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.