Bob Kline wrote:
> On Sun, 25 Mar 2001, Daniel Berger wrote:
> 
> > Ah, crud - I forgot to mention that I *do not* want to read the
> > entire file into memory, which the readlines method appears to do
> > (unless I'm mistaken). I also would like to avoid tricks like
> > creating temporary files.

If you're working under Unix, "tail -n" would be a simple solution.

def last_lines(file, nr_lines)
  `tail -n #{nr_lines} #{file}`
end

last_lines("/var/log/messages", 5)

-- 
Michael Neumann