SORT(DOS) UNIX System V SORT(DOS)
Name
sort - sorts data
Syntax
sort [drive:][pathname][/r][/+n]
Description
The sort command lets you alphabetize a file according to
the character in a certain column. You specify the file by
the drive: and pathname options.
The switches are:
/r Reverses the sort, that is, sorts from Z to A.
/+n Sorts the file according to the character in column n,
where n is some number. If you do not specify this
switch, the sort command sorts the file according to
the character in the first column.
Examples
The following command reads the file expenses.txt, sorts it
in reverse order, and writes the output to a file named
budget.txt:
sort /r expenses.txt budget.txt
The following command pipes the output of dir to sort. The
sort command filter sorts the directory listing starting
with column 14 (the column in the directory listing that
contains the file size) and sends the output to the screen.
The result is a directory, sorted by file size:
dir | sort /+14
The following command does the same thing as the previous
one, except that more gives you a chance to read the sorted
directory one screenful at a time:
dir | sort /+14 | more
Notes
sort does not distinguish between uppercase and lowercase
letters.
sort is an external command.
SORT(DOS) (printed 8/16/89) SORT(DOS)