Brett Simmers
7/4/2007 10:50:00 PM
f = File.open('filename')
until f.gets.chomp == "---------"; end
#continue processing here
That should do the trick. The next line returned by f.gets will be the
first line after the "--------". If you want the actual line number,
f.lineno should give it to you.
-Brett
Al Cholic wrote:
> Hello,
>
> I have a file that includes a "---------" string at a certain line
> number. How can I find out at which line number the string occurs?
> Would it be best to split the text file into an array with split("\n")
> and then use a for loop or is there some other hidden methods in ruby?
>
> Basically I want to start reading a text file after the "---------" line
> that appears in it.
>
> Can someone help please?
>
> Thanks in advance.
>
>