If on a *nix system with tail
, you can cheat like this:
last_25_lines = `tail -n 25 whatever.txt`
More Related Contents:
- How to search file text for a pattern and replace it with a given value
- How to write to file in Ruby?
- What are all the common ways to read a file in Ruby?
- What are the Ruby File.open modes and options?
- How to search a folder and all of its subfolders for files of a certain type
- Read binary file as string in Ruby
- The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256
- Can’t install gems on OS X “El Capitan”
- How to test if a string is basically an integer in quotes using Ruby
- How can I track system-specific config files in a repo/project?
- What’s the difference between Ruby’s dup and clone methods?
- Gem installation error: You have to install development tools first (Windows)
- Nokogiri/Xpath namespace query
- cannot load such file — script/rails : Getting this error while remote debugging through RubyMine
- How can I have ruby logger log output to stdout as well as file?
- What’s the difference between a string and a symbol in Ruby?
- Operator precedence for And/&& in Ruby [duplicate]
- How to avoid “cannot load such file — utils/popen” from homebrew on OSX
- Why does Ruby have both private and protected methods?
- Is it possible to have Methods inside Methods?
- Accessing elements of nested hashes in ruby [duplicate]
- How to read lines of a file in Ruby
- How do I redirect stderr and stdout to file for a Ruby script?
- Convert array of 2-element arrays into a hash, where duplicate keys append additional values
- How can I find the number of days between two Date objects in Ruby?
- Why is sum so much faster than inject(:+)?
- Rubygems: How do I add platform-specific dependency?
- Is there a hook similar to Class#inherited that’s triggered only after a Ruby class definition?
- How to convert JSON to a Ruby hash
- Iterate over Ruby Time object with delta