From: Daniel Berger Date: 2001-03-25T23:10:03+09:00 Subject: [ruby-talk:13197] Re: Reading a file backwards > Hi Dan, > > perhaps something like this is what you want? > > synack@eugene:~/tmp/fox-0.99.166/textedit$ cat > testFile > line 1 > line 2 > line 3 > synack@eugene:~/tmp/fox-0.99.166/textedit$ irb > irb(main):001:0> f = File.new("testFile") > # > irb(main):002:0> f.readlines.reverse.each { |line| p line } > "line 3\n" > "line 2\n" > "line 1\n" > ["line 3\n", "line 2\n", "line 1\n"] > > Hope this helps you some. > > - -- > Signed, > Holden Glova 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. Thanks again. Dan