Created
January 20, 2011 22:53
-
-
Save sflinter/788870 to your computer and use it in GitHub Desktop.
Perform an in-place (with backup) global search and replace on one or more 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
# Perform an in-place (with backup) global search and replace on one or more files | |
$ ruby -i.bak -ple '$_.gsub!(/..../, "::::")' * | |
# Replace the ... with the regular expression that you're searching for, | |
# and the ::: with what you want to replace it with. | |
# Replace the file glob with whatever is appropriate. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment