Created
April 3, 2015 06:45
-
-
Save rnakano/61ae273b55851639665c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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