summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/ext/Encode/bin/ucmsort
blob: 774f62528a2a1c6ed70bcab8cc7e58a223f41731 (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
#!/usr/local/bin/perl
#
# $Id: ucmsort,v 1.2 2003/12/03 03:02:28 millert Exp $
#
use strict;
my @lines;
my ($head, $tail);
while (<>){
    unless (m/^<U/o){
        unless(@lines){
	    $head .= $_;
	}else{ 
	    $tail .= $_;
	}
	next;
    }
    chomp;
    push @lines,[ split ];
}

print $head;
for (sort {
    $a->[0] cmp $b->[0] # Unicode descending order
	or $a->[2] cmp $b->[2] # fallback descending order
	    or $a->[1] cmp $b->[1] # Encoding descending order
	}
	      @lines) {
    print join(" " => @$_), "\n";
}
print $tail;
__END__