From: Qnmt Mndy Date: 2010-05-04T01:08:36+09:00 Subject: key search in files i am trying to find a set of keys within specific files under a specific directory. i read the keys from a file and iterate through them opening and looking all the files under the specified directory. However only the last key seems to be found in the files.. srcFiles = Dir.glob(File.join("**", "*.txt")) keys = File.readlines("sp.txt") keys.each{ |key| srcFiles.each{|src| linenumber = 0 File.readlines(src).each{ |line| linenumber += 1 if line.include? key then puts "found #{key}" } } } -- Posted via http://www.ruby-forum.com/.