Sorting on a specific part of a field

You can also sort on a specific part of a field if necessary.

To define which part of a field to sort on you give the position in the field at which to start the sort followed by the position in the field at which to end the sort.

The position at which to start the sort is given as the number of fields to skip followed by the number of characters to skip. For example:

   +2.3

tells sort to skip the first two fields and the first three characters of field 3.

The position at which to stop the sort is given as the number of the field followed by number of the character in that field at which the sort is to stop. For example:

   -3.6

tells sort to stop the sort at the 6th character in field three.

To sort on the fourth and fifth characters of field three:

   +2.3  -3.6

[Home] [Search] [Index] This site maintained by unixhelp@mathcs.duq.edu