Skip to content

Instantly share code, notes, and snippets.

@rnakano rnakano/ack-sed
Created Apr 3, 2015

Embed
What would you like to do?
#!/usr/bin/env ruby
if ARGV.size != 3
puts "usage: ack-sed <pattern> <replace-string> <dir>"
end
query, replace, dir = ARGV
system("ack #{query} #{dir} | cut -d':' -f1 | uniq | LANG=C xargs sed -i -e 's/#{query}/#{replace}/g'")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.