#cli #replace #replacer #string #file

app sreplace

A simple to use, efficient, and full-featured command line string replacer

6 releases

0.9.5 Jan 8, 2024
0.9.4 Jan 7, 2024
0.9.3 Jul 25, 2023
0.9.2 May 3, 2023
0.9.1 Apr 26, 2023

#690 in Command line utilities

Download history 4/week @ 2023-11-01 1/week @ 2023-11-08 6/week @ 2023-11-22 14/week @ 2023-11-29 4/week @ 2023-12-06 6/week @ 2023-12-13 4/week @ 2023-12-20 4/week @ 2023-12-27 66/week @ 2024-01-03 4/week @ 2024-01-10 4/week @ 2024-01-17 6/week @ 2024-01-24 9/week @ 2024-01-31 1/week @ 2024-02-07 61/week @ 2024-02-14

77 downloads per month

GPL-3.0-only

5MB
645 lines

sreplace

A simple to use, efficient, and full-featured command line string replacer.

Sed like command line tool that aims to be simple and fast to use.

This is a rewritting of a former project of mine, from C++ to rust.

Installation

  1. install rust
  2. install sreplace using cargo:
cargo install sreplace

The ready to use executable command is sr.

Usage

sr <PATTERN> <REPLACEMENT> <PATH>

Arguments:
  <PATTERN>      The string to look for
  <REPLACEMENT>  The replacement string
  <PATH>         The path to the file or directory

Examples

$ cat hello.txt
Hello world!

$ sr world all hello.txt
Replaced 1 line in "hello.txt"

$ cat hello.txt
Hello all!

Replace in regular file

Replace in regular file

Replace recursively in folder

Replace in folder

Features

  • UTF-8 encoding support
  • Support regular expression searched patterns
  • Support case insensitive searched patterns
  • Filter on regular files extensions
  • Recursively browse directories
  • Concurrently process multiple files

License

GPL v3

Dependencies

~8–20MB
~259K SLoC