Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Tam committed May 12, 2013
1 parent 68206bd commit 81d5dd8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tab-sort
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/home/y/bin/perl -w

my $col = shift || 0;
my @lines;
while (<>) {
chomp($_);
my ($count , $keyword) = split("\t", $_);
next unless ($keyword =~ /\s/);
chomp($count);
push(@lines, [$count, $keyword]);
}
my @A_sorted = reverse sort {$a->[0] <=> $b->[0]} @lines;
foreach my $ar_line (@A_sorted)
{
print "$ar_line->[0] $ar_line->[1]\n";
}

0 comments on commit 81d5dd8

Please sign in to comment.