Created
September 6, 2015 08:16
-
-
Save Folyd/284319624e720fb6675f to your computer and use it in GitHub Desktop.
Batch replace text in mac os
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
#!/usr/bin/env bash | |
old="onFailure(MetaCode" | |
new="onFailure(int" | |
# sed -i "s/$old/$new/g" `grep $old -rl $1` | |
# sed -i -e "s/$old/$new/g" `ls` | |
#The sed command is a bit different in Mac OS X, the ‘-i’ option | |
# required a parameter to tell what extension to add for the backup file. | |
#http://www.mkyong.com/mac/sed-command-hits-undefined-label-error-on-mac-os-x/ | |
find $1 -name *.java | xargs sed -i '' "s/$old/$new/g" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment