I needed to display the tail of a log file. Thoughts of opening the file, pushing each line into a fixed length array, popping the last line off, etc filled my head. Duh - just shell out and do a tail.
Here's the one-liner as it appears in a view. It also re-sorts to display latest first:
<p><%= %x(tail -n 30 log/activity_log.log).split('\n').reverse.join('<br/>') %></p>
%x shells out to the os and returns stdout (if any) in a string.