Last active
August 12, 2016 20:49
-
-
Save marioplumbarius/23e921c14dc559b6daa1440c1712ba95 to your computer and use it in GitHub Desktop.
Shell script which finds and replaces all occurrences of given characters in files from the current directory.
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
#!/bin/bash | |
current_name=$1 | |
new_name=$2 | |
files=`grep -irl $current_name` | |
num_files=`grep -irl $current_name | wc -l` | |
echo "found $num_files file(s) with import name $current_name" | |
for ffile in $files; do | |
sed -i 's@'"$current_name"'@'"$new_name"'@g' $ffile; | |
echo "renamed in file $ffile"; | |
done | |
echo "finished renaming." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment