Article View: news.software.nn
Article #2464Re: nn folders -> mailbox format
From: Ofer Inbar
Date: Sat, 15 Feb 1992 07:51
Date: Sat, 15 Feb 1992 07:51
47 lines
2492 bytes
2492 bytes
garym@telesoft.com (Gary Morris @wayward) writes:
>
>What's wrong with just putting "set mail-format true" in your .nn/init?
>--GaryM
Ahh, this is the feature of nn that 6.4.14 was lacking and 6.4.16 has.
But since, as I said, I hadn't fully searched through the new docs,
and had been absent from the newsgroup, I didn't know this. Anyway, I
guess the script is still useful for converting old nn folders to
mailboxes, or for when you thought you didn't need mailbox format and
find that you do. And it's an interesting academic excercise to
figure out how to do the transformation :-)
Here's an updated script that looks somewhat messier, but deals with
more cases. It also fixes a bug in the original that caused it to
leave out the domains on addresses in the "From " lines. Not a
serious bug, but a bug nonetheless.
----------
#!/usr/bin/perl
while (<>)
{ if (/^Path: .*\w!\w/i || /^Xref: *\w+[\w.,]+/i
|| /^Newsgroups: *\w+[\w.,]+/i)
{ &processheaders; } else { print; }
}
sub processheaders
{ local ($lnum);
$headers[$lnum++] = $_ if /^Newsgroups:/i;
header: while (<>)
{ $headers[$lnum++] = $_ unless (/^Path:/i || /^Xref:/i);
last header if /^$/;
$from = $1 if /^From: *(\w+[@%!.][\w@%!:.]+)/i;
$date = $1 if /^Date: *(.*)/i;
}
warn "EOF inside a header block\n" unless /^$/;
print "From $from $date\n";
foreach (@headers) { print; }
}
----------
-- Cos (Ofer Inbar) -- cos@chaos.cs.brandeis.edu
-- WBRS (BRiS) -- WBRS@binah.cc.brandeis.edu WBRS@brandeis.bitnet
"GUIs normally make it simple to accomplish simple actions and impossible to
accomplish complex actions." --Doug Gwyn (22/Jun/91 in comp.unix.wizards)
Technical Details
Message-ID:
<cos.698140299@chaos.cs.brandeis.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!sparky!uunet!cs.utexas.edu!swrinde!mips!think.com!news.bbn.com!noc.near.net!news.cs.brandeis.edu!chaos.cs.brandeis.edu!cosReferences:
<cos.697743822@chaos.cs.brandeis.edu> <1992Feb12.145553.9193@telesoft.com>Show Full Headers
Complete Article Headers
Message-ID: <cos.698140299@chaos.cs.brandeis.edu> Subject: Re: nn folders -> mailbox format Date: Sat, 15 Feb 1992 07:51:39 +0000 From: cos@chaos.cs.brandeis.edu (Ofer Inbar) References: <cos.697743822@chaos.cs.brandeis.edu> <1992Feb12.145553.9193@telesoft.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!sparky!uunet!cs.utexas.edu!swrinde!mips!think.com!news.bbn.com!noc.near.net!news.cs.brandeis.edu!chaos.cs.brandeis.edu!cos Newsgroups: news.software.nn Sender: news@news.cs.brandeis.edu (USENET News System) Organization: Brandeis University Lines: 47