~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

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

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

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
}