in reply to count lines, bottom to top
perl -ne '@_=($_,@_)}{ # file is read in @_ in reverse order # for (@_) loop # data manipulation ... $count > $time and print "exceeded threshold!";' filename [download]