michael@0: #!/usr/bin/perl michael@0: #!/usr/bin/perl michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: open (STAT,$ARGV[0]) || die " cannot open data file $ARGV[0]\n"; michael@0: @count; michael@0: while() michael@0: { michael@0: @k = split(/\s+/, $_); michael@0: $count{$k[0]} = $k[1]; michael@0: } michael@0: $count = 0; michael@0: while() michael@0: { michael@0: @ck = split /\s*/, $_; michael@0: $s = 0; michael@0: $fb = 0; michael@0: $cl = $#ck; michael@0: $j = 0; michael@0: while($j < $cl) { michael@0: $cc = unpack("C", $ck[$j]); michael@0: if(0 eq $s ) { michael@0: if($cc > 0x80) { michael@0: if($cc > 0xa0) { michael@0: $fb = $ck[$j]; michael@0: $s = 2; michael@0: } else { michael@0: $s = 1; michael@0: } michael@0: } michael@0: } elsif (1 eq $s) { michael@0: } else { michael@0: if($cc > 0xa0) { michael@0: $fb .= $ck[$j]; michael@0: $count{$fb}++; michael@0: print $fb . " " .$count{$fb} . "\n"; michael@0: $s = 0; michael@0: } else { michael@0: $s = 1; michael@0: } michael@0: } michael@0: $j = $j + 1; michael@0: } michael@0: } michael@0: foreach $c (sort(keys( %count ))) michael@0: { michael@0: print $c . " ". $count{$c} . "\n"; michael@0: }