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

## 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

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

## When NOT to Use
- 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)

## Installation
- **homebrew**: `brew install sd`
- **cargo**: `cargo install sd`
- **pacman**: `sudo pacman -S sd`

---
Source: https://littlescripts.sh/tools/sd
