22 lines
365 B
Bash
Executable File
22 lines
365 B
Bash
Executable File
#!/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
|