Skip to content

Instantly share code, notes, and snippets.

@agius
Created November 1, 2013 04:32
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 agius/7260988 to your computer and use it in GitHub Desktop.
Save agius/7260988 to your computer and use it in GitHub Desktop.
Find and replace rake task
namespace :find do
desc "Find and replace"
task :replace, :find, :replace do |t, args|
find = args[:find]
replace = args[:replace]
`egrep -lRZ "#{find}" --exclude-dir='.git' --exclude-dir='db' --exclude-dir='tmp' --exclude-dir='images' --exclude-dir='fonts' --exclude-dir='vendor' . | xargs -I {} sed -i '' -e 's/#{find}/#{replace}/g' {}`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment