Skip to content

doraemonkeys/sedr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sedr

sedr is a command-line tool for in-place file editing using regular expressions.

Usage

sedr <regex> <original> <substitution> <file>
  • <regex>: Regular expression pattern
  • <original>: Original text to replace (default: $0)
  • <substitution>: Replacement text
  • <file>: File to process

Example

sedr '(\d{4})-(\d{2})-(\d{2})' '$0' '$1-$3-$2' file.txt

This command will change date formats from YYYY-MM-DD to YYYY-DD-MM in file.txt.

Features

  • In-place file editing
  • Regular expression support
  • Capture group substitution
  • Preserves file permissions

Notes

  • $0 represents the entire matched string
  • $+ can be used to represent a literal $
  • Use $1, $2, etc. in the substitution to refer to capture groups

Installation

go install github.com/doraemonkeys/sedr@latest

About

in-place file editing using regular expressions

Resources

License

Stars

Watchers

Forks

Packages

No packages published