Skip to content

Instantly share code, notes, and snippets.

@HomenSimpsor
Last active December 14, 2015 06:19
Show Gist options
  • Save HomenSimpsor/5042167 to your computer and use it in GitHub Desktop.
Save HomenSimpsor/5042167 to your computer and use it in GitHub Desktop.
Replace something in every HTML file (alternative to sed)
### 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