How to print last <n> pages of a file?

Robert Hartman rhartman at thestepchild.sgi.com
Fri May 3 08:57:50 AEST 1991


In article <1991May2.162355.779 at elroy.jpl.nasa.gov> pjs at euclid.jpl.nasa.gov writes:
>How can I print the last <n> pages of a text file?  Said file has form
>feeds at random places, so "tail -132 file | lpr" won't work.  Now, I tried
>"pr file | tail -132" but that includes the 5-line headers and footers
>that I don't want and don't get with "lpr file".  So I tried 
>"pr -t file | tail -132" but the -t option turns off page filling so the
>form feeds aren't expanded :-(.
>
>Any suggestions?  SunOS 4.1 over here.

Sounds like a job for csplit to me!  Split the pr output at the ^L characters,
and take the last n resulting files!

-r



More information about the Comp.unix.questions mailing list