Created
September 7, 2011 14:08
-
-
Save flashingpumpkin/1200647 to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| # | |
| # Usage: bulkreplace <path> <filetype> <find_pattern> <replace> | |
| function infile(){ | |
| find $1 -name "*$2" -exec grep -H "$3" {} \; | sed 's/:.*//'; | |
| } | |
| for f in $(infile $1 $2 $3); do replace "$3" "$4" -- $f; done | |
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
| $ ./bulkreplace ./src py "TODO:" "REMEMBER:" | |
| ./src/foo.py converted | |
| ./src/bar.py converted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment