Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donat/4943153 to your computer and use it in GitHub Desktop.
Save donat/4943153 to your computer and use it in GitHub Desktop.
# This file operates on every file within the current directory and below, recursively.
# The original command is from http://rushi.vishavadia.com/blog/find-replace-across-multiple-files-in-linux
# but has been modified to not mess with end of line characters (-b option in sed) according to http://stackoverflow.com/a/11508669
find . -name "*.html" -print | xargs sed -i -b 's/find/replacewith/g'
# This example command searches only .html files. This can be changed to anything.
# You need to specify what to find and what to replace it with (find/replacewith). These are regular expressions, so be careful of special characters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment