C
Chuck Dawit
I'm reading a file line by line and trying to remove the newline at the
end of each line so that I can rebuild the url with the "www" and the
".net" at the beginning and end. Does anyone know how I can remove the
newline char at the end of each line? Also if the url doesn't work/exist
I don't want the script to crash I want to keep moving through the file
its reading.
begin
while (line = f.readline)
line = line =~ /(.*?)\n/
url = "www." + line + ".net"
open(url) { |page| page_content = page.read()
puts "link exists"
}
end
rescue
puts "link does not exist"
rescue EOFError
f.close
end
end of each line so that I can rebuild the url with the "www" and the
".net" at the beginning and end. Does anyone know how I can remove the
newline char at the end of each line? Also if the url doesn't work/exist
I don't want the script to crash I want to keep moving through the file
its reading.
begin
while (line = f.readline)
line = line =~ /(.*?)\n/
url = "www." + line + ".net"
open(url) { |page| page_content = page.read()
puts "link exists"
}
end
rescue
puts "link does not exist"
rescue EOFError
f.close
end