Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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. It is inspired by ed, Unix's first text editor and was developed as an enhanced replacement of . 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'

The small command set and tools like "addressing" (line filtering) allow for easy and compact, yet powerful manipulations. While sed is Turing-complete and could theoretically be used for any complex tasks, it is not meant to be a programming tool. As soon as tasks like counting or column manipulation are involved, tools like or are likely a better choice.

External references

Further reading