From: Alex Young Date: 2007-08-10T19:00:35+09:00 Subject: Re: newbie question: how to seek in a file Ak 756 wrote: > Konrad Meyer wrote: >> On Friday 10 August 2007 02:09:56 am Konrad Meyer wrote: >>> my_data = $1 >> Better yet: >> READ_BYTES = 16 >> content = File.open('foo'){|f| f.read } >> my_data = content[content.index("find this string"), READ_BYTES] >> # I tried to combine Lutz's and my earlier ideas >> >> Though this of course assumes the string is found. > > I don't care about huge file at present and this method works for me. > Thanks Konrad and Lutz. I believe you can also do this with RExpect, but I'm on Windows right now and can't test it out. -- Alex