in reply to problem sorting by non-consecutive fields

One way to do it would be to use a Schwartzian Transform combined with the Logical Short Circuit 'or' operator for sort comparison fall-through.

my @data = ( "7 modify ldfapg pub abc.h", "8 modify bfxml dtd/src newfiles.ksh", "9 delete bfxml dtd/src newfiles.ksh", "10 modify bfxml dtd/src newfiles.ksh" ); my @sorted = map { $_->[0] } sort { $a->[1][2] cmp $b->[1][2] or $a->[1][0] <=> $b->[1][0] } map { [ $_, [ split /\s+/, $_ ] ] } @data;

UPDATE: What do you mean by "using sort +2 +0 -n file the third field should be sort based on the first letter and the first based on the number."??? Are you using Perl and Perl's sort, or are you using your operating system's sort tool?


Dave