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](#benchmarking) section below.
**Documentation**: For usage instructions, please refer to the [GNU sed manual](https://www.gnu.org/software/sed/manual/). Red is designed to work exactly like GNU sed.
---
## Features
- **GNU sed Compatible**: Drop-in replacement for GNU sed
- **Cross-Platform**: Runs on Linux, macOS, and Windows
- **SELinux Support**: Preserves SELinux contexts during in-place editing (Linux)
- **Memory Safe**: Written in Rust
- **Full Command Support**: All GNU sed commands
---
## Command-Line Options
```
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
```
---
## Architecture
Red uses a two-phase architecture:
1.**Compile Phase**: Parse and validate scripts once
2.**Execute Phase**: Apply commands to input data
For detailed documentation, see [ARCHITECTURE.md](ARCHITECTURE.md).