aboutsummaryrefslogtreecommitdiff
path: root/sort-interim.pl
blob: 59821b37d1e9fc31001300e7c77165322c298f4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env perl 
 
my $this;
my %elts;
 
sub process {
    my $data = shift;
    my $key;
 
    $data =~ m@\s+U([[:xdigit:]]+)\s+@;
    $key=$1;
    if ($elts{$key}) {
print STDERR "Warning: key $key found more than once.\n";
    }
    $elts{$key}=$data;
}
 
while (<>) {
    if (/(?:###\+)?<MM>/) {
while (/(?:###\+)?<MM>/) {
    $this .= $_;
    $_ = <>;
}
process $this;
$this='';
    }
    $this .= $_;
}
 
for $k (sort { hex($a<=> hex($b) } keys %elts) {
    print $elts{$k};
}