# File lib/rake/file_list.rb, line 285
285:     def egrep(pattern, *options)
286:       matched = 0
287:       each do |fn|
288:         begin
289:           open(fn, "r", *options) do |inf|
290:             count = 0
291:             inf.each do |line|
292:               count += 1
293:               if pattern.match(line)
294:                 matched += 1
295:                 if block_given?
296:                   yield fn, count, line
297:                 else
298:                   puts "#{fn}:#{count}:#{line}"
299:                 end
300:               end
301:             end
302:           end
303:         rescue StandardError => ex
304:           $stderr.puts "Error while processing '#{fn}': #{ex}"
305:         end
306:       end
307:       matched
308:     end