If you're looking at a long log file and you want to see the most recent lines first, you might use the tail -r (25.15) command. It shows the lines of a file in reverse order, last line first. It will give up if your file is too big, though. How big "too big" is depends on your version of tail. To find out, try a very big text file and see how far tail -r goes:
%tail -r /usr/dict/words > /tmp/words.tailr
%ls -l /tmp/words.tailr /usr/dict/words
-rw-r--r-- 1 jerry 32768 Dec 5 09:49 /tmp/words.tailr -rw-r--r-- 1 root 206672 Feb 8 1990 /usr/dict/words
flip | tail -r quit after 32768 characters on our system. The flip program has no theoretical limit, but it needs enough system memory to hold your file (or its standard input). Here it is, courtesy of Tom Christiansen: |
---|
#!/usr/local/bin/perl print reverse <>
-