in reply to Reversing A File

You can use tac if you are on a Unix-like system:
$ echo "one > two > three" > foo $ cat foo one two three $ tac foo three two one
--
Andreas

Replies are listed 'Best First'.
Re^2: Reversing A File
by tuxz0r (Pilgrim) on Dec 12, 2007 at 16:06 UTC
    If you don't have tac on your system (which some of our AIX boxes don't), you can also use this short script,
    #!/bin/sh file=$1; i=1 max=`wc -l $file | cut -d' ' -f1,1 ` while [ $i -le $max ]; do tail -$i $file | head -1 i=$((i+1)) done
    Call it much like tac,
    $ ./reverse your.file > reverse.file
    It's not as fast as tac obviously, but if you don't have 'tac' and want to reverse a file it does work.

    ---
    s;;:<).>|\;\;_>?\\^0<|=!]=,|{\$/.'>|<?.|/"&?=#!>%\$|#/\$%{};;y;,'} -/:-@[-`{-};,'}`-{/" -;;s;;$_;see;
    Warning: Any code posted by tuxz0r is untested, unless otherwise stated, and is used at your own risk.