Last active
November 10, 2024 05:02
-
-
Save nateflink/9056302 to your computer and use it in GitHub Desktop.
Revisions
-
nateflink revised this gist
Feb 17, 2014 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ #!/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]" -
nateflink revised this gist
Feb 17, 2014 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,10 +9,10 @@ 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 -
nateflink created this gist
Feb 17, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ #!/bin/bash #By Nate Flink if [ -z "$1" ] || [ -z "$2" ]; then echo "Usage: ./$0 [find string] [replace string]" exit 1 fi FIND=$1 REPLACE=$2 #sed -i "" is needed by the osx version of sed (instead of sed -i) find ${DIRPATH} -type f | xargs sed -i "" "s|${FIND}|${REPLACE}|g" export LC_CTYPE=C; export LANG=C; find . -type f -exec sed -i "" "s|${FIND}|${REPLACE}|g" {} + exit 0