File: tail.rb

package info (click to toggle)
ruby-file-tail 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 236 kB
  • sloc: ruby: 901; makefile: 3
file content (10 lines) | stat: -rwxr-xr-x 231 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/env ruby

require 'file/tail'

filename = ARGV.pop or fail "Usage: #$0 number filename"
number = (ARGV.pop || 0).to_i.abs

File::Tail::Logfile.open(filename) do |log|
  log.backward(number).tail { |line| puts line }
end