What does sed do?

stream editor — transform text line by line.

▸ Explain your own sed command →

sed examples, explained

$ sed -i 's/a/b/g' file.txt

  • sedstream editor — transform text line by line
  • -iedit files in place instead of printing to stdout
  • s/a/b/gsubstitute: replace "a" with "b" — every match on the line, not just the first
  • file.txtan argument passed to the command

$ sed -n -e '1,10p' file.txt

  • sedstream editor — transform text line by line
  • -nsuppress automatic printing (use with p)
  • -eadd the next argument as an editing script
  • 1,10pvalue for -e
  • file.txtan argument passed to the command

sed flags & options

-iedit files in place instead of printing to stdout
-nsuppress automatic printing (use with p)
-eadd the next argument as an editing script
-Euse extended regular expressions
-ruse extended regular expressions (GNU)
--in-placeedit files in place

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.