
June 27th, 2009, 03:37 PM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 5
Time spent in forums: 1 h 49 m 5 sec
Reputation Power: 0
|
|
|
How to skip a line when reading a file
Hi guys,
How do I tell a program reading a file line by line to skip a line. For example I need to find a line which contains a match to a certain pattern and then I need to pull the name which appears on the next line in the file (but is not in a predetermined format so can't look for it directly). I imagine it should be something like this:
page.each {|line|
url = line.match(companyPattern)
if url != nil
line = line.next ???? how do i tell it to go to next line here??
name = line.strip
end
}
Thanks.
|