This bash function was helpful: function replace(){ grep "$1" -rl . grep "$1" -rl . | xargs sed -i "s/$1/$2/g"; }