Download: rgrep.rb
dirname = ARGV[0]
regexp_string = ARGV[1]
def search_file(file,regexp)
   f = File.open(file,'r')
   found = false
#	puts file
   f.each{|line|
      if line.match(regexp)
         if not found
            puts "\n#{file}"
         end
         puts "\t" + line
         found = true
      end
   }
   f.close
end
   
require 'find'
Find.find(dirname) do |file|
   print '.'
   search_file(file,/#{regexp_string}/) if File.file?(file)
end