[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inplace stream editing with tee --quiet --overwrite

From: Roman Czyborra
Subject: Re: inplace stream editing with tee --quiet --overwrite
Date: Thu, 17 May 2001 07:28:10 +0200 (MEST)

Silly me askseds:

> how do you shorten (shuffle up) a huge logfile or mailbox A
> without losing the latest appends or the inode hardlinks?

Don't try this at home:

>  flushlines=`grep -n '^From ' $mbox | tail -$count | head -1 | cut -d: -f1`
>  into='open(A,"+<".shift);while(<>){print A};truncate(A,tell A)'
>  test "$flushlines" -gt 0 && tail -$flushlines $mbox | perl -e "$into" $mbox

This meant to say

   test "$flushlines" -gt 1 && tail +$flushlines $mbox | perl -e "$into" $mbox

to expire old mail messages from the beginning.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]