From 8c042f99cc7465c86351d21331a129111b75345d Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 16 Jul 2010 12:41:09 +0300 Subject: Move to gawk-3.0.0. --- test/lastnpages | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 test/lastnpages (limited to 'test/lastnpages') diff --git a/test/lastnpages b/test/lastnpages deleted file mode 100644 index 0acb7738..00000000 --- a/test/lastnpages +++ /dev/null @@ -1,47 +0,0 @@ -From nstn.ns.ca!news.cs.indiana.edu!news.nd.edu!spool.mu.edu!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!dali.cs.montana.edu!milton!uw-beaver!fluke!ssc-vax!brennan Mon May 6 23:41:40 ADT 1991 -Article: 26492 of comp.unix.questions -Path: cs.dal.ca!nstn.ns.ca!news.cs.indiana.edu!news.nd.edu!spool.mu.edu!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!dali.cs.montana.edu!milton!uw-beaver!fluke!ssc-vax!brennan -From: brennan@ssc-vax.UUCP (Michael D Brennan) -Newsgroups: comp.unix.questions -Subject: Re: How to print last pages of a file -Message-ID: <3948@ssc-bee.ssc-vax.UUCP> -Date: 6 May 91 15:42:00 GMT -Article-I.D.: ssc-bee.3948 -Organization: Boeing Aerospace & Electronics, Seattle WA -Lines: 33 - - -The following shell & (new) awk program prints the last n pages. - -If you get more than 65 lines to a page, the program that inserts -the ^L's should be fixed. - -------------------------------------------------------------- -#!/bin/sh -# usage: lastpages -- prints 1 page reads stdin -# lastpages n -- prints n pages reads stdin -# lastpages n files -- prints n pages, reads file list - -program='BEGIN{RS = ORS = "\f" } - - -{ page[NR] = $0 - if ( NR > numpages ) delete page[NR-numpages] -} - -END { - i = NR - numpages + 1 - if ( i <= 0 ) i = 1 - - while( i <= NR ) print page[i++] -}' - - -case $# in -0) awk "$program" numpages=1 - ;; -1) awk "$program" numpages=$1 - ;; -*) pages=$1 ; shift - awk "$program" numpages=$pages $* ;; -esac - - -- cgit v1.2.3