Last active
December 14, 2015 06:19
-
-
Save HomenSimpsor/5042167 to your computer and use it in GitHub Desktop.
Replace something in every HTML file (alternative to 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
### Perform a search and replace from the commandline | |
$ vim -c '%s`search`replace`g' -c 'wq' *.html | |
### Alternatively, load all your files into vim and use bufdo. Allows you to tweak your search pattern before running the replacement: | |
$ vim *.html | |
/search | |
:bufdo %s``replace`g | |
:wall | |
### This seems easier than using sed: | |
$ find . -name '*.html' | xargs sed -i 's`search`replace`g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment