Subject: | |
From: | |
Reply To: | COLE,GLENN (Non-HP-SantaClara,ex2) |
Date: | Wed, 10 Jan 2001 14:42:40 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Tony Newton writes:
> I can't remember for the life of me how to print an entire file minus the
> last 'x' lines on UX 10.20. I played with tail for awhile but that didn't
> get me anywhere. Any suggestions.
There are at least two choices.
One is 'head' (suggested by Bill Proudfoot), and another is 'sed'.
The following examples assume you want to print all but the final
three (3) lines of a file named xxx.
totlines=`wc -l < xxx`
head -`expr $totlines - 3` xxx
totlines=`wc -l < xxx`
sed -n "1,`expr $totlines - 3`p" xxx
No doubt there are other, more elegant solutions.
This should get you started, though.
--Glenn
|
|
|