[net.unix] How to print back-to-front

jeff@heurikon.UUCP (08/25/84)

What's a good (and fast) way to print an ACSII
file from the back to the front?  I.e., I'm
looking for a command that outputs the *last*
line of a file first and the *first* line last.

A loop with 'head -$nn file | tail -1' is too
slow and messy.

Thanks in advance.
-- 
/"""\	Jeffrey Mattox, Heurikon Corp, Madison, WI
|O.O|	{harpo, hao, philabs}!seismo!uwvax!heurikon!jeff  (news & mail)
\_=_/				     ihnp4!heurikon!jeff  (mail - fast)

gwyn@BRL-VLD.ARPA (08/26/84)

From:      Doug Gwyn (VLD/VMB) <gwyn@BRL-VLD.ARPA>

Question:  How to print a file last line first, first line last.

Answer:  Prefix line numbers, then "sort -rn", then strip line numbers.

kemp@noscvax.UUCP (08/27/84)

  tail -r filename
  lists the file backwards.

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

berry@zinfandel.UUCP (08/27/84)

In article <601@noscvax.UUCP> kemp@noscvax.UUCP (Stephen P. Kemp) writes:
>
>  tail -r filename
>  lists the file backwards.
>

Well, on my VAX 750 with 4.1BSD, tail -r of a LARGE file prints the
last block or two backwards, then gives up.

-- 
Berry Kercheval		Zehntel Inc.	(ihnp4!zehntel!zinfandel!berry)
(415)932-6900

ajs@hpfcla.UUCP (ajs) (09/17/84)

Listing a file  backwards:  Someone  posted  tac(1) a while  back.  It's
quite nice and very  useful.  I could  repost it or mail it with  manual
entry...

/*
 * From: cmcl2!salkind
 * Newsgroups: net.sources
 * Title: Line reversing program
 .
 .
 .

Alan Silverstein, hpfcla!ajs