SORT – Windows CMD Command

Sort will accept a redirected or piped file input and TYPE the file, sorted line by line.

/+n : Sort the file ignoring the first one or more characters in each row.
The default (/+1) will sort using all characters in each row.
/+2 will start comparing at the second character, /+3 the third etc.
Lines with fewer than n characters collate before other lines.

Override the system default locale with
The “C” locale yields a faster
collating sequence.
The sort is always case insensitive.

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.

The maximum number of characters in a row or record
(default 4096, maximum 65535)

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.

The path of the directory to hold
SORT’s working storage, in case the data
does not fit in RAM. The default is %temp%

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.

Redirecting a file into SORT
SORT < pathname

Piping a command into SORT

command | SORT

Piping the output from SORT into a file

command | SORT > pathname2
SORT < pathname > pathname2

Piping the output from SORT and appending to an existing file

command | SORT >> pathname2
SORT < pathname >> pathname2

You may also like...

1 Response

  1. Steve says:

    These are really great ideas in about blogging. You have touched
    some fastidious things here. Any way keep up wrinting.

Leave a Reply

Your email address will not be published. Required fields are marked *