sed is a command-line stream editor for filtering and transforming text.

Sed is a stream editor: it reads one line of input, performs editing commands, and moves on to the next line. Sed is a companion to ed, Unix's first text editor. Sed is a standard utility.

By far the most common usage of sed is to perform a simple pattern replacement:

sed -e 's/pattern/replacement/g'

However, sed is Turing-complete; more complex scripts are possible, but quickly become cryptic. A good alternative for tasks that are complicated in sed is .

Further reading

history | excerpt history