dotfiles/.local/bin/scripts/rpl

9 lines
297 B
Plaintext
Raw Normal View History

#!/bin/bash -e
# Use grep and sed to replace $1 with $2 recursively and print what is done
2021-05-02 17:35:50 +00:00
grep --null --recursive --files-with-matches \
2022-07-18 10:56:48 +00:00
--binary-files=without-match $(echo $DIRS_IGNORE | sed 's/-x/--exclude-dir/g') "${@:3}" -- "$1" |
2022-04-12 17:31:46 +00:00
xargs -0 sed -i "\%${1}%{
2021-05-05 06:56:44 +00:00
s||${2}|g
w /dev/stdout
}"