← Software

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.

License: GPL-3.0-or-later

Category: CLI tools

Website: https://www.gnu.org/software/sed/

Install

Already preinstalled on Linux. macOS ships BSD sed; for GNU sed:
  brew install gnu-sed

Authors

  • GNU Project (sed maintainers)
PreviousGNU screen NextGNU tar

This site is currently in Beta. Contact: Chris Paton

Textbook of AI · Textbook of Usability · Textbook of Digital Health

Auckland Maths and Science Tutoring