[net.unix] reversing lines

jiml@pesnta.UUCP (Jim Livingston) (08/28/84)

I can't get tail -r to work on this system, but I find that
rev will do the same thing.

If you have it, try it.

gino@voder.UUCP (Gino Bloch) (08/30/84)

    >> From: jiml@pesnta.UUCP (Jim Livingston)
    >> I can't get tail -r to work on this system, but I find that
    >> rev will do the same thing.

On my system (4.2) rev reverses a file character-for character.

dan@digi-g.UUCP (Dan Messinger) (09/07/84)

>     >> I can't get tail -r to work on this system, but I find that
>     >> rev will do the same thing.
> 
> On my system (4.2) rev reverses a file character-for character.

On my system (V7) rev reverses the characters of each line of a file,
but prints lines in the original order.

kemp@noscvax.UUCP (Stephen P. Kemp) (09/18/84)

On 4.2 bsd systems, the following will work (I think there are no restrictions
regarding the file contents):

     % cat -n filename | sort -nr | sed "s/^.......//" 

cat -n prefixes the input with lines numbers; sort -nr sorts using the numbers
as the sort key, and outputs the lines in reverse order; sed strips the 
line numbers off again and the result ought to be what you want.

Steve Kemp	 {ihnp4, decvax, akgua, dcdwest, ucbvax}!sdcsvax!noscvax!kemp
Computer Sciences Corp.         kemp@nosc
Naval Ocean Systems Center
San Diego, CA