sedr is a command-line tool for in-place file editing using regular expressions.
sedr <regex> <original> <substitution> <file>
<regex>: Regular expression pattern<original>: Original text to replace (default: $0)<substitution>: Replacement text<file>: File to process
sedr '(\d{4})-(\d{2})-(\d{2})' '$0' '$1-$3-$2' file.txtThis command will change date formats from YYYY-MM-DD to YYYY-DD-MM in file.txt.
- In-place file editing
- Regular expression support
- Capture group substitution
- Preserves file permissions
$0represents the entire matched string$+can be used to represent a literal$- Use
$1,$2, etc. in the substitution to refer to capture groups
go install github.com/doraemonkeys/sedr@latest