Last active
December 28, 2015 05:39
-
-
Save elliot-nelson/7450998 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
# Find foo's and replace with bar's, backing up as *.bak | |
grep -rl "foo" app/views | xargs sed -i .bak s/foo/bar/g | |
# Alternate: Require other patterns on the line | |
grep -rl "grok" app/views | xargs sed -i .bak -e '/grok/ s/foo/bar/g' | |
# Throw away the backup files | |
find . -name *.bak -print | xargs rm | |
# Another possibility, if all relevant files are part of the repo | |
git clean -f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment