← Back to tools

sd

An intuitive find-and-replace CLI tool, a sed alternative

Text Processing linuxmacoswindows Rust MIT

Description

sd is a simple, fast find-and-replace tool. It uses regex syntax that is easier to use than sed (no escaping slashes, uses familiar regex flavor) and supports both string and regex replacements.

Install

homebrewbrew install sd
cargocargo install sd
pacmansudo pacman -S sd

AI Summary

An intuitive find-and-replace CLI. Uses modern regex syntax without sed's escaping quirks, making text substitution simpler and more readable.

Capabilities

  • + Simple regex-based find and replace
  • + No need to escape slashes or use delimiters
  • + In-place file modification
  • + Supports capture groups and backreferences

Use When

  • Need simple find-and-replace in files or pipes
  • Want to avoid sed's awkward escaping rules
  • Quick text substitution in a pipeline

Avoid When

  • x Need sed's full scripting capabilities (multi-command, line addressing)

Usage Patterns

Replace in a file

sd 'old_text' 'new_text' file.txt

Replaces all occurrences in-place

Replace in a pipe

echo 'hello world' | sd 'world' 'rust'

Performs replacement on stdin

Input / Output

stdin: Text to perform replacements on
stdout: Text with replacements applied (when reading from stdin)
Exit codes:
0 Success
1 Error
View AGENTS.md for sd