| Crates.io | red-sed |
| lib.rs | red-sed |
| version | 1.0.2 |
| created_at | 2026-01-10 20:27:49.068701+00 |
| updated_at | 2026-01-17 07:22:42.691345+00 |
| description | An experimental drop-in replacement for GNU sed, written in Rust |
| homepage | |
| repository | https://github.com/vyavdoshenko/red |
| max_upload_size | |
| id | 2034662 |
| size | 938,150 |
An experimental drop-in replacement for GNU sed, written in Rust.
This project started as an experiment to understand how far one can go in creating a Rust replacement for GNU sed.
Functional Compatibility: As far as I know, red currently achieves 100% functional compatibility with GNU sed behavior.
Performance: There's still work to be done on the performance front. For performance comparisons and benchmarks, please refer to the Benchmarking section below.
Documentation: For usage instructions, please refer to the GNU sed manual. Red is designed to work exactly like GNU sed.
Usage: red [OPTION]... {SCRIPT} [FILE]...
red [OPTION]... -e SCRIPT... -f FILE... [FILE]...
Options:
-n, --quiet, --silent suppress automatic printing of pattern space
-e SCRIPT, --expression=SCRIPT
add the script to the commands to be executed
-f FILE, --file=FILE add the contents of script-file to the commands
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if SUFFIX supplied)
-r, -E, --regexp-extended
use extended regular expressions
-s, --separate consider files as separate rather than continuous
-l N, --line-length=N specify line-wrap length for 'l' command
-u, --unbuffered load minimal amounts of data and flush output often
-z, --null-data use NUL character as line separator
--posix disable all GNU extensions
--follow-symlinks follow symlinks when processing in place
--sandbox disable e/r/w commands
--help display this help and exit
--version output version information and exit
Red uses a two-phase architecture:
For detailed documentation, see ARCHITECTURE.md.
# Unit tests
cargo test
# Fetch GNU sed tests (required once)
./scripts/fetch_gnused_tests.sh
# GNU sed compatibility tests
./scripts/run_gnused_tests.sh
# Specific test
./scripts/run_gnused_tests.sh --test-pattern "help.sh"
# Fast mode
./scripts/run_gnused_tests.sh --fast
Compare performance with GNU sed:
# Install hyperfine
cargo install hyperfine
# Run benchmarks
./scripts/benchmark.sh
# Custom runs
RUNS=50 WARMUP=5 ./scripts/benchmark.sh
RED_BIN=./target/release/red SED_BIN=/usr/bin/sed ./scripts/benchmark.sh
# Debug build
cargo build
# Release build
cargo build --release
# Build with SELinux support (Linux only)
cargo build --release --features selinux
Pre-built binaries are available on the Releases page:
| Platform | File | Notes |
|---|---|---|
| Linux x86_64 | red-linux-x86_64-musl.tar.gz |
Static binary, works on any Linux |
| Linux ARM64 | red-linux-aarch64-musl.tar.gz |
Static binary for ARM64 |
| Linux x86_64 + SELinux | red-linux-x86_64-gnu-selinux.tar.gz |
For Fedora, RHEL, CentOS |
| Linux ARM64 + SELinux | red-linux-aarch64-gnu-selinux.tar.gz |
ARM64 with SELinux |
| macOS Intel | red-darwin-x86_64.tar.gz |
macOS 10.15+ |
| macOS Apple Silicon | red-darwin-aarch64.tar.gz |
macOS 11+ (M1/M2/M3) |
| Windows | red-windows-x86_64.zip |
Windows 10+ |
From crates.io:
cargo install red-sed
Linux:
curl -LO https://github.com/vyavdoshenko/red/releases/latest/download/red-linux-x86_64-musl.tar.gz
tar -xzf red-linux-x86_64-musl.tar.gz
sudo mv red /usr/local/bin/
macOS:
curl -LO https://github.com/vyavdoshenko/red/releases/latest/download/red-darwin-aarch64.tar.gz
tar -xzf red-darwin-aarch64.tar.gz
xattr -d com.apple.quarantine red # Remove Gatekeeper quarantine
sudo mv red /usr/local/bin/
Verify:
red --version
red/Cargo.tomlgit tag v1.0.0
git push origin v1.0.0
GitHub Actions will automatically build all platforms and create a release with artifacts.
Use - in tag for pre-releases (e.g., v1.0.0-beta).
MIT