2000-12-11 21:40:33 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
2021-05-07 16:56:14 +02:00
|
|
|
# Copyright (c) 2021, PostgreSQL Global Development Group
|
|
|
|
|
2000-12-11 21:40:33 +01:00
|
|
|
# this script will sort any table with the segment data type in its last column
|
|
|
|
|
2016-12-04 18:00:00 +01:00
|
|
|
use strict;
|
2020-04-13 17:55:45 +02:00
|
|
|
use warnings;
|
2016-12-04 18:00:00 +01:00
|
|
|
|
|
|
|
my @rows;
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
while (<>)
|
|
|
|
{
|
|
|
|
chomp;
|
|
|
|
push @rows, $_;
|
2000-12-11 21:40:33 +01:00
|
|
|
}
|
|
|
|
|
2012-07-05 03:47:49 +02:00
|
|
|
foreach (
|
|
|
|
sort {
|
2016-12-04 18:00:00 +01:00
|
|
|
my @ar = split("\t", $a);
|
|
|
|
my $valA = pop @ar;
|
2012-07-05 03:47:49 +02:00
|
|
|
$valA =~ s/[~<> ]+//g;
|
|
|
|
@ar = split("\t", $b);
|
2016-12-04 18:00:00 +01:00
|
|
|
my $valB = pop @ar;
|
2012-07-05 03:47:49 +02:00
|
|
|
$valB =~ s/[~<> ]+//g;
|
|
|
|
$valA <=> $valB
|
|
|
|
} @rows)
|
|
|
|
{
|
|
|
|
print "$_\n";
|
2000-12-11 21:40:33 +01:00
|
|
|
}
|