Fast find & replace CLI with regex support and intuitive syntax
sd is a find & replace command-line tool that uses JavaScript/Python-compatible regex syntax instead of sed's traditional patterns. It supports both regex and string-literal modes, with the -F flag disabling regex for literal string replacement. The tool processes files in-place by default or can preview changes with the -p flag.
The tool operates in two processing modes: line-by-line (default) for low memory usage and streaming output, or across mode (-A flag) for patterns that need to match across line boundaries. sd supports both indexed capture groups ($1, $2) and named capture groups ($dollars, $cents) with ${var} syntax for disambiguation.
Benchmarks show sd performing 2-12x faster than sed on various workloads, particularly with regex replacements on large files. The tool integrates well with other Unix tools like fd for project-wide replacements and handles edge cases like argument parsing with -- delimiter support.
# via Cargo
cargo install sd