[feature] bulk replace
This commit is contained in:
parent
a980991fdc
commit
733da17292
21
bin/br
Executable file
21
bin/br
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$#" -lt 2 ]; then
|
||||
echo "Usage: $0 <target> <replacement>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REDFG=$(printf '\033[31m')
|
||||
BLUBG=$(printf '\033[42m')
|
||||
ag --color "$1" . | sed -E "s/$1/\\0$REDFG$BLUBG$2/g"
|
||||
echo Are they ok for you?
|
||||
read -r YN
|
||||
|
||||
case "$YN" in
|
||||
y|Y)
|
||||
ag "$1" . -l -0 | xargs -0 sed -Ei "s/$1/$2/g"
|
||||
;;
|
||||
*)
|
||||
exit
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue
Block a user