in reply to Sorting question...
This makes lots of assumptions about your data format which wasn't very clear.
Ie. no extra blank lines between the records (change 1..6 to 1..7 if there are) and that all the skew values are of the form 'n.nnnn' (adjust the regex and/or use sprintf in the $_ = $1 . $_ otherwise).
It uses the Advanced Sorting - GRT - Guttman Rosler Transform algorithm.
Usage: script < unsorted > sorted
#! perl -slw use strict; open my $fh, '<', $ARGV[ 0 ] or die "Couldn't open $ARGV[ 0 ]: $!"; my @records; push @records, join '', map{ scalar <$fh> } 1 .. 6 while not eof( $fh ); print stderr 'Record count: ', scalar @records; my @sorted = map { substr $_, 5 } sort map{ m[skew: ([\d.]{5})]; $_ = $1 . $_ } @records; chomp @sorted; print for @sorted;
|
|---|