Command: sort
SORT sorts a file or input for displaying.
The file for input is not modified.
Syntax:
sort [/R] [/N] [/+num] [/A] [/?] [drive][path]filename
command | sort [/R] [/N] [/A] [/+num] [/?]
drive The drive letter, e.g. C:
path The directory, e.g. \example\
filename The driver (file) to load, e.g. unordered.txt
Options:
/R Sort in reverse order (Z - A).
/A Sort by ASCII, ignore COUNTRY.
/N Enables NLS / CODEPAGE / COUNTRY based SORT ORDER.
/+num Begin sorting at column num in each line of text. Default=1.
/? Shows the help.
Comments:
SORT does not change the input file, only the output.
SORT supports NLS (national language support).
Examples:
Displays the current directory in alphabetical order:
dir | sort
Sorts a file and writes it to another file:
sort unordered.txt > ordered.txt
sort -ENTER- (alternativ: sort /+2)
this -ENTER-
is -ENTER-
a -ENTER-
short -ENTER-
sentence -ENTER-
(CTRL-Z) (exits the command and executes it)
gives out: sorted by second letter per line:
a a
is sentence
sentence this
short short
this is
See also:
country
codepage
more
type
File:
Please read this command's lsm file also.
You will find the updated version (internet) here and
the version described in this manual page here.
The lsm file contains information about the name of the programmer,
the download site, and some other command related information.
Copyright © 1998 Jim Hall, updated 2007 by W. Spiegl.
This file is derived from the FreeDOS Spec Command HOWTO.
See the file H2Cpying for copying conditions.