sort question

Paul Houtz gph at hpsemc.HP.COM
Wed May 17 04:57:39 AEST 1989


I wrote:

> Here is the worst one I have seen on Unix.  I converted this myself from a
>sort done on an IBM System/34.  This is a good example of a COMMON type of
>sort done in the commercial world which you never see on Unix:
>
>sort -dt'\012' +0.6 -0.8 +0.13 -0.15 +0.15r -0.17r +0.8 -0.13 DISK-SUMARY >SUM1
>
>This guy sorts the summary file using the newline character as a field 
>delimiter (i.e., no fields), and you can tell what column ranges are 
>being sorted by subtracting 1 from the 'x' field of the 0.x parms.  
>
> It sorts the 5  thru 7  columns in ascending order, 
> the 12 thru 14 columns in ascending order,
> the 14 thru 16 columns in DESCENDING order, (the "r" after the column)
> then the 7  thru 12 columns in ascending order.

Dr. T. Andrews, Systems, CompuData, Inc. DeLand, writes:

Ah, yes, that's an ugly command.  Now, what is the command to run the
general "sort" program on the "friendly" op sys where you would
prefer, performing the same sort?

Okay, in MPE, you do this:

sort
input DISK-SUMARY
output SUM1
key 5,7;12,14;14,16,DESC;7,12
end

The "key" parm says to sort column 5 thru 7 ascending, 
                                   12 thru 14 ascending
                                   14 thru 16 descending,
                                    7 thru 12 ascending.

That seems much clearer to me.



More information about the Comp.unix.questions mailing list