From owner-freebsd-questions@FreeBSD.ORG Thu Jan 27 11:34:55 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8134E16A4CE for ; Thu, 27 Jan 2005 11:34:55 +0000 (GMT) Received: from smtp817.mail.sc5.yahoo.com (smtp817.mail.sc5.yahoo.com [66.163.170.3]) by mx1.FreeBSD.org (Postfix) with SMTP id 1B99343D1F for ; Thu, 27 Jan 2005 11:34:55 +0000 (GMT) (envelope-from krinklyfig@spymac.com) Received: from unknown (HELO smogmonster.com) (jtinnin@pacbell.net@64.173.27.163 with login) by smtp817.mail.sc5.yahoo.com with SMTP; 27 Jan 2005 11:34:55 -0000 From: Joshua Tinnin To: freebsd-questions@freebsd.org, mikko@whitecortex.net Date: Thu, 27 Jan 2005 03:34:54 -0800 User-Agent: KMail/1.7.2 References: <1106824011.86743.21.camel@whitecortex.net> In-Reply-To: <1106824011.86743.21.camel@whitecortex.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501270334.54817.krinklyfig@spymac.com> Subject: Re: Script to merge mailinglist archives X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2005 11:34:55 -0000 On Thursday 27 January 2005 03:06 am, Mikko Heiskanen 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