<<< Date Index >>>     <<< Thread Index >>>

Re: purging mailboxes



On Fri, Jan 28, 2011 at 04:57:13PM -0500, Jean-Pierre Radley wrote:
> It would be nice to automate the maintenance, so: could a script (also
> run by cron) manage a mailbox by pruning messages older than some
> <number> of days, or by deleting all but the last <number> of messages?

The latter is 'easy' :-)

Use 'grep -n '^From ' | tail -n <count>' extract the line number from the
first output line and use sed (or similar) to delete the first of the file.

        David

-- 
David Laight: david@xxxxxxxxx