Script to merge mailinglist archives

Joshua Tinnin krinklyfig at spymac.com
Thu Jan 27 03:34:55 PST 2005


On Thursday 27 January 2005 03:06 am, Mikko Heiskanen 
<mikko at whitecortex.net> wrote:
> Hi list.
>
> I've found archives of freebsd-questions mailinglist very useful.
> But I have found them difficult to search, as in one month there can
> be many archives, not just one per month.
> So I would like to merge all archives of the same month into a single
> mailbox containing all messages sent that month (I am aware this file
> could come quite large).
> I have a feeling this can be a simple shellscript/one-liner with some
> awk magic, but I am having hard time figuring out how to tackle the
> problem. I should somehow be able to compare a list of files which
> match the month, and cat >> results to a file whose filename comes
> that matched months last 2 digits of year+ 2 digits of month. And
> this for all the files in a directory containing, say, archives from
> 1998 -> 2005. Easy?

I'm assuming you're using mbox format. Well, to make it easier you might 
want to use something like /usr/ports/mail/archmbox. I use it in a cron 
job for archiving questions from the -questions list on a machine where 
Mutt is the default mail client. When I'm using this machine I use 
KMail's expire feature. But I'm sure it's relatively easy to script. 
You might look at archmbox as an example - it's written in Perl.

- jt


More information about the freebsd-questions mailing list