Q
Qnmt Mndy
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}"
}
}
}
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}"
}
}
}