Read a text file in reverse

Here\'s a simple way to view a text file in reverse in Linux. This is particularly useful for viewing the most recent log entries from your web or other service.

Found here: http://www.tek-tips.com/viewthread.cfm?SQID=562146&SPID=822&newpid=822&page=1

sed \'1!G;h;$!d\' logfile

You might want to toss in a \"more\", so that you can see this one page at a time. I.e.

sed \'1!G;h;$!d\' logfile |more

Be forewarned, it takes a lot of memory and time to do this!

Related Scribbles:
  • Utilities
  • Text (and Word Document) Editing
  • Linux Commands


  • ID: 269
    Author:
    leonard
    Date Updated:
    2003-12-23 00:22:55
    Date Created:
    2003-10-28 15:04:38

    Edit

    Comments?
     >> Leonard Chan's Homepage  >> Scribble Web  >> Read a text file in reverse
    leonard.lotus-land.ca is hosted by Perceptus Solutions Inc.