Created
May 9, 2018 18:05
-
-
Save jaburns/c850773ca52d081092f3c48a4fce6c00 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
find_files() { | |
ag "$1" | cut -d: -f1 | sort | uniq | |
} | |
do_replace() { | |
echo "Finding files matching orignial string $1" | |
for f in $(find_files "$1"); do | |
echo " -> Replacing string in file $f" | |
sed -i "s/$1/$2/g" "$f" | |
done | |
} | |
do_replace OLD_0 NEW_0 | |
do_replace OLD_1 NEW_1 | |
# etc... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment