4 ms·
Cool. That hurts my eyes. ruby -e "print ARGF.readlines.last(10)"
by davnola 15y ago
Cool. That hurts my eyes.
ruby -e "print ARGF.readlines.last(10)"
- rytis 15y agoon, say, a 5GB log file?.. If I read this correctly (http://www.ruby-doc.org/core/classes/IO.html#M000914 http://www.ruby-doc.org/core/classes/IO.html#M000914) it'll read the whole file into an array, then spit out last 10 entries?
- davnola 15y agoYes it does - good point, but the sigil-tastic snippet in the parent reads the whole file into an array, too - it's just harder to tell. Plus the parent snippet is not Ruby 1.9 compatible. Anyways, my version was just to illustrate that sysadmin scripting in Ruby does not have illegible.