~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to contrib/seg/sort-segments.pl

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
# this script will sort any table with the segment data type in its last column
 
4
 
 
5
while (<>) {
 
6
  chomp;
 
7
  push @rows, $_;
 
8
}
 
9
 
 
10
foreach ( sort {
 
11
  @ar = split("\t", $a);
 
12
  $valA = pop @ar;
 
13
  $valA =~ s/[~<> ]+//g;
 
14
  @ar = split("\t", $b);
 
15
  $valB = pop @ar;
 
16
  $valB =~ s/[~<> ]+//g;
 
17
  $valA <=> $valB
 
18
} @rows ) {
 
19
  print "$_\n";;
 
20
}