#sed #delete #text #file #string-literal #in-place #replace

app rd

simple utils to replace and delete text in text files

4 releases

0.2.0 Aug 13, 2021
0.1.2 Jul 5, 2021
0.1.1 Jun 26, 2021
0.1.0 Jun 15, 2021

#12 in #in-place

GPL-3.0 license

19KB
193 lines

rd

Very simple utility to replace(r)/delete(d) strings in text files

installation

cargo install rd

usage

rd "replace" "with" -f file.txt

by default, it uses regex, for string literals

rd -s "replace" "with" -f file.txt

replace inplace by

rd "replace" "with" -f file.txt -i

delete matching lines

rd "to_delete" -f file.txt -d

modify multiple files

rd "replace" "with" -f *.txt

with fd

rd "replace" "with" -f $(fd '.*\.txt')

performance

Much faster than GNU sed (2x), but slower than sd (2x) for large files. Similar to sd for small files

Good Design Choices

  1. Do not touch the file unless there is a change. This is useful when modifying a long list of files and do not want to leave a trail in every files pass on the command line

Dependencies

~6–17MB
~218K SLoC