Last active
August 3, 2016 11:30
-
-
Save flavianmissi/e29d199e90e68af07ad0 to your computer and use it in GitHub Desktop.
find and replace with sed
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
find . -name *.py -type f -print0 -exec sed -i '' 's/pattern/new_pattern/g' {} + | |
# the above code seems to be bugged, instead: | |
for p in ` find . -name "*.html" -type f`;do sed -i '' 's/slug/tobase64/g' $p;done | |
# if you're not on OS X there is no need to pass -i '' to sed, just run: | |
find . -name *.py -type f -print0 -exec sed -i 's/pattern/new_pattern/g' {} + | |
# this avoids the "invalid command code ." error (on OS X) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment