sed
CLIStream editor for filtering and transforming text.
0 views
Installation
Homebrew
brew install gnu-sedLinks
License
GPL-3.0AI Agent Notes
Stream editor for in-place text substitution
When to use
Simple find-and-replace in files or streams
Examples
sed 's/foo/bar/g' file.txtsed -i 's/old/new/g' *.txt
Proven Recipes
Replace string in file (in-place)🟢 95% success
sed -i '' 's/oldtext/newtext/g' file.txt⚠ Common failures (1)
- sed: 1: unexpected EOF on macOS → macOS sed requires empty string after -i: sed -i '' ...
Delete lines matching pattern🟢 97% success
sed '/pattern/d' file.txtPrint specific line number🟢 99% success
sed -n '5p' file.txt