dotfiles/.local/bin/scripts/rpl
2022-09-10 19:04:18 +02:00

8 lines
297 B
Bash
Executable file

#!/bin/bash -e
# Use grep and sed to replace $1 with $2 recursively and print what is done
grep --null --recursive --files-with-matches \
--binary-files=without-match $(echo $DIRS_IGNORE | sed 's/-x/--exclude-dir/g') "$1" -- "${@:3}" |
xargs -0 sed -i "\%${1}%{
s||${2}|g
w /dev/stdout
}"