Skip to content

Instantly share code, notes, and snippets.

@costis
Created October 13, 2012 18:06
Show Gist options
  • Save costis/3885595 to your computer and use it in GitHub Desktop.
Save costis/3885595 to your computer and use it in GitHub Desktop.
Search and replace in files
The other big option here is simply not to use vim:
sed -i 's/pattern/replacement/' <files>
or if you have some way of generating a list of files, perhaps something like this:
find . -name *.cpp | xargs sed -i 's/pattern/replacement/'
grep -rl 'pattern1' | xargs sed -i 's/pattern2/replacement/'
and so on!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment