GNU sed
The GNU stream editor.
sed reads input line by line and applies a small editing language: substitutions (s/old/new/), deletions (/regex/d), appends, inserts, branches, and labels. It is the classic Unix text-stream editor, indispensable for one-liner transformations in shell pipelines, build scripts, and ad-hoc fixups.
GNU sed adds extensions over the POSIX baseline: in-place editing (-i), extended regular expressions (-E), the e flag in the s command for evaluating shell, and a handful of others. The most commonly-used extension is in-place editing with backups (sed -i.bak 's/foo/bar/g' file) for rewriting files non-destructively.
sed is one of the foundational Unix text-processing tools, alongside awk and grep. Despite the more interactive feel of modern editors and the rise of higher-level scripting languages, sed remains popular for short, pipe-friendly transformations that would be overkill in Python or awk.
Install
Already preinstalled on Linux. macOS ships BSD sed; for GNU sed: brew install gnu-sed
Authors
- GNU Project (sed maintainers)