B
Bob Hatch
I am new to Ruby and am pulling my hair out on something that I know is
simple. I am searching a large text file, line by line for text that
will reside in part of the line. If it finds part of the text, I want to
delete the line. Here is what I have that is not working. Help is
appreciated! Thanks in advance!
# process every line in a text file
file='c:\ruby192\my_projects\IIS_Logs\ex11012607.log'
text=File.readlines(file).each do |line|
search_text = "/memberinfo/downline/tree/canvas.asp"
if(line.gsub!(search_text) == search_text) then
#line.clear
puts search_text
else
puts "Not Found"
end
#puts line
end
simple. I am searching a large text file, line by line for text that
will reside in part of the line. If it finds part of the text, I want to
delete the line. Here is what I have that is not working. Help is
appreciated! Thanks in advance!
# process every line in a text file
file='c:\ruby192\my_projects\IIS_Logs\ex11012607.log'
text=File.readlines(file).each do |line|
search_text = "/memberinfo/downline/tree/canvas.asp"
if(line.gsub!(search_text) == search_text) then
#line.clear
puts search_text
else
puts "Not Found"
end
#puts line
end