Last active
October 26, 2016 20:40
-
-
Save wteuber/5345178 to your computer and use it in GitHub Desktop.
batch in-place replacement off content visible files, excluding dot files
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
# grep -l -R -I --exclude "*.log" -e "old_stuff" . ## list files that contain old_stuff, excluding .log files | |
# grep -v '/\.' ## don't list dot files | |
# xargs sed -i "s/old_stuff/new_stuff/g" ## replace (and save) old_stuff with new_stuff in those files. | |
grep -l -R -I --exclude "*.log" -e "old_stuff" . | grep -v '/\.' | xargs sed -i "s/old_stuff/new_stuff/g" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OSX/zsh: grep -l -R -I --exclude "*.log" -e "old_stuff" . | grep -v '/.' | xargs sed -i "" "s/old_stuff/new_stuff/g"