Crates.io | rep-grep |
lib.rs | rep-grep |
version | 0.0.7 |
source | src |
created_at | 2023-06-25 21:32:59.530784 |
updated_at | 2024-01-01 10:49:04.237466 |
description | wgrep/write-grep CLI |
homepage | https://github.com/robenkleene/rep-grep |
repository | https://github.com/robenkleene/rep-grep.git |
max_upload_size | |
id | 899829 |
size | 6,620,169 |
rep
is a command-line utility that takes grep
-formatted lines via standard input, and performs a find-and-replace on them. By default, it outputs a diff
-preview of the changes to standard output, and with a flag it can write the changes to the files in place.
Output a diff to standard output replacing foo
with bar
:
grep -n foo *` | rep foo bar
Add the -w
flag to write the changes to the files in place:
grep -n foo *` | rep foo bar -w
The -n
(--line-number
) option is required so that grep
outputs the line number for each match.
rep
is available via cargo
:
cargo install rep-grep
The default pager is less
, the REP_PAGER
environment variable can be used to override the pager (e.g., export REP_PAGER=delta
in Bash).
rep -h
(or rep --help
, --help
provides slightly longer explanations of some options) will list help for all the command-line flags.
rep
was inspired by wgrep
for Emacs, which allows editing grep
results in an Emacs buffer and then writing those changes to the source files.sd
. rep
began as a fork of sd
.rep
was borrowed from delta`.