-
-
Save cesarferreira/a4eef646208bc50a6917b6cd2a1e5139 to your computer and use it in GitHub Desktop.
This file contains 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 | |
#By Nate Flink | |
#Invoke on the terminal like this | |
#curl -s https://gist.github.com/nateflink/9056302/raw/findreplaceosx.sh | bash -s "find-a-url.com" "replace-a-url.com" | |
if [ -z "$1" ] || [ -z "$2" ]; then | |
echo "Usage: ./$0 [find string] [replace string]" | |
exit 1 | |
fi | |
FIND=$1 | |
REPLACE=$2 | |
#needed for byte sequence error in ascii to utf conversion on OSX | |
export LC_CTYPE=C; | |
export LANG=C; | |
#sed -i "" is needed by the osx version of sed (instead of sed -i) | |
find . -type f -exec sed -i "" "s|${FIND}|${REPLACE}|g" {} + | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment