0dd8cb7c169067a1a06fd7aa7b96165fb69293b7
[ipreg/sccs2rcs2cvs2git.git] / ipreg-mail-uplift
1 #!/usr/bin/perl
2
3 # reformat from MH to mbox
4
5 use warnings;
6 use strict;
7
8 sub shite { die "ipreg-mail-uplift: @_: $!\n"; }
9 sub shit { die "ipreg-mail-uplift: @_\n"; }
10
11 for my $f (<ipreg-mail/Institutions/*>) {
12 next unless -f $f;
13 print "processing $f\n";
14 open my $in, '<', $f
15 or shite "open < $f";
16 my @f = <$in>;
17 map s{^[+][+][+]\s+
18 ([a-z]+[0-9]*[ ] # user
19 [A-Z][a-z][a-z][ ] # day
20 [A-Z][a-z][a-z])\s+ # mon
21 ([0-9]+)\s+ # date
22 ([0-9][0-9]:[0-9][0-9]:[0-9][0-9][ ] # time
23 [A-Z][A-Z][A-Z][ ] # zone
24 [12][0-9][0-9][0-9])\s*$ # year
25 }{sprintf "From %s %2d %s\n", $1, $2, $3}xe,
26 @f;
27 open my $out, '>', "$f.new"
28 or shite "open > $f.new";
29 print $out @f;
30 }