[HPADM] Summary: Text Processing - Removing First/Last Page

From: Justin Willoughby (jwilloug@mhc.net)
Date: Thu Apr 10 2003 - 11:18:49 EDT


Brett showed me just what I need to accomplish my goal!

Thanks so much!

- Justin

==================
 Justin Willoughby
 Computer Operations
==================

>>> "Brett Geer" <brett.geer@dhl.com> 04/10/03 10:01AM >>>

FIRST=`grep -n "^L" file.dat | head -1 | awk -F":" '{print $1}'`
LAST=`grep -n "^L" file.dat | tail -1 | awk -F":" '{print $1}'`

awk -vFIRST=$FIRST -vLAST=$LAST '(NR > FIRST && NR < LAST) { print $0 } ' file.dat

a kludge but I've just tried it and it appears to work here... you could do similar things with sed and tail/head but hey :)

brett
-----Original Message-----
From: hpux-admin-owner@DutchWorks.nl [mailto:hpux-admin-owner@DutchWorks.nl]On Behalf Of Justin Willoughby
Sent: 10 April 2003 03:34
To: <
Subject: [HPADM] Text Processing - Removing First/Last Page

I don't do a lot of text processing in Unix so I don't know what tool will do what I want.

Basically I would like to be able to remove the first and last page from a ascii file in Unix. Pages are separated by a ^L

Do I need to use Perl or is there a standard Unix tool for doing this?

Thanks so much!

- Justin

==================
 Justin Willoughby
 Computer Operations
==================

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:28 EDT