From: Nathan Olberding Date: 2006-05-04T00:49:09+09:00 Subject: Re: Searching Files Michael Greenly wrote: > require 'find' > > search_term = /pear/ > > Find.find("./") do |path| > next unless File.file?(path) > File.open(path) do |file| > lineno = 0 > file.each do |line| > lineno += 1 > if line =~ search_term > puts "#{path}:#{lineno} " + line > end > end > end > end I've played with this and it seems to have the same problem as my original code: it will only find maybe 10% of the results I expect (so far only one result in either implementation, no matter the search). In this case, if I hard-code the search_term, then the very script I'm running is the only file that will ever produce a result (as it is in the directory I'm traversing). Sorry if I've ignored any other replies. I'm using the ruby-forum interface, which seems to have been down for some time yesterday. -- Posted via http://www.ruby-forum.com/.