"Joseph McDonald" <joe / vpop.net> writes: > > Here's the code: > > #################################################### > > i = 0 > > while true do > > i += 1 > > puts i > > rptFile = "CYPsw00695.rpt" #a 190K text file > > srchStr = "/Error/" > > rpt_h = File.open rptFile > > puts "after File.open #{rptFile}" if $DEBUG > > puts "srchStr is: #{srchStr}" if $DEBUG > > while rpt_h.gets do > > #puts "while: #$_" if $DEBUG > > if eval srchStr > > I wonder if eval is causing you problems? It is probably > slowing you down at least. Can you do something like: > > srchStr = "Error|Blah" > while line = gets > if line =~ /#{srchStr}/ > puts line > end > end or even srchStr = /Error|Blah/ puts File.open(rptFile).grep(srchStr) which may be faster or slower depending on the percentage of lines that match. Dave