From: Lutz Horn Date: 2007-08-10T18:06:53+09:00 Subject: Re: newbie question: how to seek in a file Hi, Ak 756 wrote: > I want to find a string in a text file, then read some bytes data after > the position of this string. Would anybody kindly help to tell me how to > do? You could do something like this: File.open("my-file.txt") do |f| i = f.read.index(/search/) f.seek(i) puts f.read(10) end Lutz -- Posted via http://www.ruby-forum.com/.