5-58 Utility Descriptions
SORT
The SORT command sorts a text file and displays the output to the
standard device.
Syntax
SORT [/R] [/+n] [[drive1:][path1]filename1] [> [drive2:][path2]filename2]
or
command | SORT [/R] [/+n] [> [drive2:][path2]filename2]
Remarks
SORT normally starts its comparisons at the first character in a line. The
input to SORT may come from a file, or it may be piped in from another
filter or any other DOS
command
.
Options
The /+n option causes SORT to begin its alphabetical sorting starting at
the n
th
position in the string. The /r option causes SORT to sort in the
reverse alphabetical order.
Examples
SORT NAMES.LST
Sorts the file NAMES.LST and displays the output to the screen.
DIR | SORT /+14 | MORE
Produces a directory and then sorts the directory by file size (the file size
in a directory display starts on the 14th position in each line or string).
The output display is then shown one screen at a time using the MORE
command.