From: Bob Hatch Date: 2011-02-04T06:37:31+09:00 Subject: Search directory for containing specified string 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/.