|
SORT
Reads input, sorts data, and writes the results to the
screen, to a file, or to another device.
Syntax
SORT [options]
Options
/R : Reverse sort order (Z to A, 9 to 0)
/+n : Sort the file ignoring the first 'n' characters in
each row.
The default is to sort using all the chars in each row.
/L[OCALE] locale
Overrides the sort order of characters defined by
the system default locale (that is, the language
and Country/Region selected during installation).
/M[EMORY] kilobytes
The amount of RAM to use for the sort.
The best performance is usually achieved by
not specifying a memory size.
SORT will only create a temporary file
when required by limitations in available memory.
/REC[ORD_MAXIMUM] characters
Specifies the maximum number of characters in a
record, or a line of the input file (the default is
4,096, and the maximum is 65,535).
[drive:][pathname]
The file to be sorted.
If not specified, the standard input is sorted.
Specifying an input file is faster than
redirecting the same file as standard input.
/T[EMPORARY] [drive:][path]
Specifies the path of the directory to hold the
SORT command's working storage, in case the data
does not fit in main memory. The default is to use
the system temporary directory.
/O[UTPUT] [drive:][pathname]
The file where the sorted input is to be stored.
If not specified, the data is written to standard
output.
Specifying an output file is faster than
redirecting standard output to a file.
In using the /+n command-line option, for example, /+3
indicates that each comparison should begin at the third
character in each line. Lines with fewer than n characters
collate before other lines. By default, comparisons start at
the first character in each line.
You can use the pipe (|) symbol to direct data through the
sort command from another command, or to direct the sort
output to another command.
The sort command does not distinguish between uppercase and
lowercase letters.
Examples
The following command reads the file Records.txt, sorts it
in reverse order, and displays it on your screen:
SORT /r records.txt
To search a large file named Contacts.txt for the text
"John," and to sort the results of the search, use the pipe
(|) to direct the output of a find command to the sort
command, as follows:
FIND "John" cotacts.txt | SORT
Cmd Commands
|