I am trying to search a directory for all files that contain a specific
string. My code can be found below. Currently, there are no errors, but
it is not giving me filenames for files containing the text string I am
looking for.

search_text = %r{
  .refreshrates().|
  .orderclose.
}x
files = Dir.glob("*.MQ4") {|filename|
      File.open(filename) do |outfile|
        outfile.each_line do |line|
    if line =~ search_text then
        puts filename
          end
        end
      end
}

-- 
Posted via http://www.ruby-forum.com/.