Commit | Line | Data |
ab3374e4 |
1 | #!/usr/local/bin/perl |
2 | # |
7237418a |
3 | # $Id: ucmsort,v 2.0 2004/05/16 20:55:16 dankogai Exp $ |
ab3374e4 |
4 | # |
5 | use strict; |
6 | my @lines; |
7 | my ($head, $tail); |
8 | while (<>){ |
9 | unless (m/^<U/o){ |
10 | unless(@lines){ |
11 | $head .= $_; |
12 | }else{ |
13 | $tail .= $_; |
14 | } |
15 | next; |
16 | } |
17 | chomp; |
18 | push @lines,[ split ]; |
19 | } |
20 | |
21 | print $head; |
22 | for (sort { |
23 | $a->[0] cmp $b->[0] # Unicode descending order |
24 | or $a->[2] cmp $b->[2] # fallback descending order |
25 | or $a->[1] cmp $b->[1] # Encoding descending order |
26 | } |
27 | @lines) { |
28 | print join(" " => @$_), "\n"; |
29 | } |
30 | print $tail; |
31 | __END__ |