Skip to content

Instantly share code, notes, and snippets.

@topher6345
Created February 24, 2017 18:51
Show Gist options
  • Save topher6345/a72c7bc3bc5dbe0fea535b4ae109de90 to your computer and use it in GitHub Desktop.
Save topher6345/a72c7bc3bc5dbe0fea535b4ae109de90 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
unless ARGV[0] && ARGV[1]
puts <<-USAGE
Recursive global search and replace string
usage #{__FILE__} search replace
USAGE
exit(1)
end
exec "rg -l #{ARGV[0]} | xargs sed -i '' -e 's/#{ARGV[0]}/#{ARGV[1]}/g'"a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment