Created
May 21, 2010 18:18
-
-
Save patrickt/409203 to your computer and use it in GitHub Desktop.
This file contains 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/ruby | |
if ARGV.size < 1 | |
puts "#{$0} folder1 [folder2 [folder3 ...]]" | |
exit 1 | |
end | |
ARGV.each do |folder| | |
`find #{folder} -name '*.txt'`.each do |f| | |
file = f.chomp | |
content = `grep critical #{file}` | |
open(file, "w") { |io| io.print content } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment