Reading the last n lines of a file in Ruby?

If on a *nix system with tail, you can cheat like this:

last_25_lines = `tail -n 25 whatever.txt`

Leave a Comment