From: Simon Krahnke Date: 2008-12-22T05:56:41+09:00 Subject: Re: get first and last line from txt file - how? * Yaser Sulaiman (2008-12-20) schrieb: > I'm just wondering.. > Let's say that we only need to read the last line. Can we do that without > reading the other lines? Yes, of course. It's exactly the same problem as reading the first line. The only difference is that there is a standard function for the first line: gets. For the last line you need to implement it yourself. If I had mmap in Ruby, I'd just map the file into memory and do mapped_file[/^.*\z/]. mfg, simon .... l