Next: , Up: Data Manipulation Commands

29.2.1 sortn – Sort a Text File by Numbers (Real or Integer)

sortn and bigsortn sort files based on numbers found in each line in the file. The operation is specified through the command line, or if blank, the operations are specified interactively. sortn will sort a file containing no more than 25000 lines each containing no more than 133 characters. For bigsortn, the limits are 100000 lines.

The command line syntax is

     sortn [/r] input-file output-file col1 size1 [col2 size2 ...]

coln are the positions of data, sizen is the number of characters for each data entry. The output file is sorted based on these keys after they have been converted to numbers. If the fields cannot be converted, then zero is used instead. If input-file is specified as a `-', then standard input is used. If output-file is specified as a `-', then standard output is used. The flag, /r, specifies that the sorting should be reversed, i.e. biggest first.