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