SORT
Sorts the contents of files.
SORT [/R] [/+n] [/M size] [/L locale] [/REC recordbytes] [[drive1:][path1]filename1] [/T [drive2:][path2]] [/O [drive3:][path3]filename3]
Where:
/R[EVERSE]
- Reverses the sort order (Z to A then 9 to 0, instead of 0 to 9 then A to Z)./+n
- Specifies that it should sort by characters from then
-th position of each line onwards. For example, if in a file we have:
If we useADG BURP WA
/+2
we will get:WA ADG BURP
/M[EMORY] size
- Specifies the maximum amount of memory to use for sorting, after which the command terminates (minimum: 160 KB)./L[OCALE] locale
- Overwrites the system default locale with the specified setting./REC[ORD_MAXIMUM] recordbytes
- Specifies the maximum number of characters in a record (default 4096, maximum 65535).[drive1:][path1]filename1
- Specifies the file to sort. If not specified, standard input is sorted (that is, the user will be prompted to enter lines directly at the prompt, terminating the acquisition with Ctrl + C)./T[EMPORARY] [drive2:][path2]
- Specifies the path to the directory that contains the sort results if the data does not fit in main memory (RAM). If not specified, the system temporary directory is used./O[UTPUT] [drive3:][path3]filename3
- Specifies the file to store the sorted input. If not specified, the data is written to the standard output (command prompt).
Examples:
1. Sorts the file C:\popdown\i.rtf
by reversing the sort order, sorting by the first quarter characters of the line and after, specifying to end the command at 200 KB, and specifying that the sort results be stored in the file C:\i.txt
:
sort /r /+4 /m 200 "C:\popdown\i.rtf" /o "C:\i.txt"
2. Sorts the standard input requested from the user and displays it in the command processor console:
sort
Comments