From: "Ara.T.Howard" Date: 2004-05-01T05:14:00+09:00 Subject: Re: Navigating Files by Line Number On Sat, 1 May 2004, John Baker wrote: > Hi > > I've tried the following code on Win XP, Ruby 1.8rc1 and > Mac OS X 10.3, Ruby 1.6.8. From the online documentation I > pretty much copied and tried the following code: > > f = File.new("testfile.txt") > puts f.gets >> This is line 1 > puts f.gets >> This is line 2 > f.lineno = 9 >> > puts f.lineno >> 9 > puts f.gets >> This is line 3 > > Although f.lineno updates to 9, it never seems to affect > the line number next read. if the file is small: line = IO.readlines 'testfile.txt' p line[9] > > Thanks > John > ______________________________________________________________ > Herbalife Independent Distributor http://www.healthiest.co.za > > > -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | URL :: http://www.ngdc.noaa.gov/stp/ | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done ===============================================================================