mirror of
https://github.com/radareorg/iaito.git
synced 2026-02-14 02:41:55 +02:00
22 lines
400 B
Bash
Executable File
22 lines
400 B
Bash
Executable File
#!/bin/sh
|
|
a="$1"
|
|
b="$2"
|
|
if [ -z "$a" ]; then
|
|
echo "Usage: sys/subst.sh [old] [new]"
|
|
exit 1
|
|
fi
|
|
#[ -z "$a" ] && a="r_str_chop "
|
|
#[ -z "$b" ] && b="r_str_trim "
|
|
WHERE="src"
|
|
git grep "$a" ${WHERE} | less -R
|
|
if [ -n "$b" ]; then
|
|
FILES=`git grep "$a" ${WHERE} | cut -d : -f 1 | uniq `
|
|
for f in $FILES ; do
|
|
echo "Sedded $a"
|
|
sed -e "s/$a/$b/g" < $f > $f.sub
|
|
mv $f.sub $f
|
|
done
|
|
else
|
|
echo "Oops"
|
|
fi
|