>>> On Tue, Sep 4, 2007 at  2:32 PM, in message
<[EMAIL PROTECTED]>, "Edmund R. MacKenty"
<[EMAIL PROTECTED]> wrote: 
> On Tuesday 04 September 2007 14:21, Scully, William P wrote:
>>What's the best technique for trimming a file?  IE: I have file
>>"/var/log/toolarge".  What's the fastest technique to discard
>>
>>- The first 10,000 records?
> 
> head -n 10000 /var/log/toolarge > /var/log/toolarge.$$ &&
> mv /var/log/toolarge.$$ /var/log/toolarge

MacK, this will keep only the first 10K records, not discard them.

>>- The last 10,000 records?
> 
> tail -n 10000 /var/log/toolarge > /var/log/toolarge.$$ &&
> mv /var/log/toolarge.$$ /var/log/toolarge

And this will keep only the last 10K records, not discard them.


Mark Post

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to