sort.exe

  • File Path: C:\WINDOWS\system32\sort.exe
  • Description: Sort Utility

Hashes

Type Hash
MD5 EBE8A846A84EDEA9D9969D61EBB28548
SHA1 809EDDC75ABC983AAC1C553EC5E439A373197798
SHA256 F6BF1F1F4046EAEDBF9B36965FCA8DE6F8E5ED5D15F7E3F6F102EDFD42BD0C11
SHA384 01169655880FE70971A9A043A6958A80971D7A71E1C4D14B3827538D4E9D81FCC41662846ED3370AA85ED0D97832B2AC
SHA512 1E05E8BD8F7C6E223204C1ACFA0AB683D767C4BA38A2C99F8C3BFDA8943F5B0386FE3CCEC0BDE0B02E92A7D2626DD84B42F50F88DB895241F073C6062374BBEA
SSDEEP 768:nUXgo4XanHGG40FgFz+EnSukJr6i36SS:UQogvvkJmSS

Runtime Data

Usage (stdout):

SORT [/R] [/+n] [/M kilobytes] [/L locale] [/REC recordbytes]
  [[drive1:][path1]filename1] [/T [drive2:][path2]]
  [/O [drive3:][path3]filename3]
  /+n                         Specifies the character number, n, to
                              begin each comparison.  /+3 indicates that
                              each comparison should begin at the 3rd
                              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.
  /L[OCALE] locale            Overrides the system default locale with
                              the specified one.  The ""C"" locale yields
                              the fastest collating sequence and is
                              currently the only alternative.  The sort
                              is always case insensitive.
  /M[EMORY] kilobytes         Specifies amount of main memory to use for
                              the sort, in kilobytes.  The memory size is
                              always constrained to be a minimum of 160
                              kilobytes.  If the memory size is specified
                              the exact amount will be used for the sort,
                              regardless of how much main memory is
                              available.

                              The best performance is usually achieved by
                              not specifying a memory size.  By default the
                              sort will be done with one pass (no temporary
                              file) if it fits in the default maximum
                              memory size, otherwise the sort will be done
                              in two passes (with the partially sorted data
                              being stored in a temporary file) such that
                              the amounts of memory used for both the sort
                              and merge passes are equal.  The default
                              maximum memory size is 90% of available main
                              memory if both the input and output are
                              files, and 45% of main memory otherwise.
  /REC[ORD_MAXIMUM] characters Specifies the maximum number of characters
                              in a record (default 4096, maximum 65535).
  /R[EVERSE]                  Reverses the sort order; that is,
                              sorts Z to A, then 9 to 0.
  [drive1:][path1]filename1   Specifies the file to be sorted.  If not
                              specified, the standard input is sorted.
                              Specifying the input file is faster than
                              redirecting the same file as standard input.
  /T[EMPORARY]
    [drive2:][path2]          Specifies the path of the directory to hold
                              the sort's working storage, in case the data
                              does not fit in main memory.  The default is
                              to use the system temporary directory.
  /O[UTPUT]
    [drive3:][path3]filename3 Specifies the file where the sorted input is
                              to be stored.  If not specified, the data is
                              written to the standard output.   Specifying
                              the output file is faster than redirecting
                              standard output to the same file.


Usage (stderr):

Invalid switch.


Signature

  • Status: Signature verified.
  • Serial: 330000023241FB59996DCC4DFF000000000232
  • Thumbprint: FF82BC38E1DA5E596DF374C53E3617F7EDA36B06
  • Issuer: CN=Microsoft Windows Production PCA 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
  • Subject: CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US

File Metadata

  • Original Filename: Sort.EXE.MUI
  • Product Name: Microsoft Windows Operating System
  • Company Name: Microsoft Corporation
  • File Version: 10.0.18362.1 (WinBuild.160101.0800)
  • Product Version: 10.0.18362.1
  • Language: English (United States)
  • Legal Copyright: Microsoft Corporation. All rights reserved.

Additional Info*

*The information below is copied from MicrosoftDocs, which is maintained by Microsoft. Available under CC BY 4.0 license.


sort

Reads input, sorts data, and writes the results to the screen, to a file, or to another device.

Syntax

sort [/r] [/+<N>] [/m <kilobytes>] [/l <locale>] [/rec <characters>] [[<drive1>:][<path1>]<filename1>] [/t [<drive2>:][<path2>]] [/o [<drive3>:][<path3>]<filename3>]

Parameters

Parameter Description
/r Reverses the sort order (that is, sorts from Z to A and from 9 to 0).
/+<N> Specifies the character position number where sort will begin each comparison. N can be any valid integer.
/m <kilobytes> Specifies the amount of main memory to use for the sort in kilobytes (KB).
/l <locale> Overrides the sort order of characters that are defined by the system default locale (that is, the language and Country/Region selected during installation).
/rec <characters> Specifies the maximum number of characters in a record or a line of the input file (the default value is 4,096 and the maximum is 65,535).
[<drive1>:][<path1>]<filename1> Specifies the file to be sorted. If no file name is specified, the standard input is sorted. Specifying the input file is faster than redirecting the same file as standard input.
/t [<drive2>:][<path2>] Specifies the path of the directory to hold the sort command’s working storage if the data does not fit in the main memory. By default, the system temporary directory is used.
/o [<drive3>:][<path3>]<filename3> Specifies the file where the sorted input is to be stored. If not specified, the data is written to the standard output. Specifying the output file is faster than redirecting standard output to the same file.
/? Displays help at the command prompt.
Remarks
  • By default, comparisons start at the first character of each line. The /+ command-line option starts comparisons at the character that is specified by N. For example, /+3 indicates that each comparison should begin at the third character of each line. Lines with fewer than N characters collate before other lines.

  • The memory used is always a minimum of 160 KB. If the memory size is specified, the exact specified amount is used for the sort (must be at least 160 KB), regardless of how much main memory is available.

  • The default maximum memory size when no size is specified is 90% of the available main memory, if both the input and output are files, or 45% of main memory otherwise. The default setting usually gives the best performance.

  • Currently, the only alternative to the default locale is the C locale, which is faster than natural language sorting (it sorts characters according to their binary encodings).

  • You can use the pipe symbol (|) to direct input data to the sort command from another command or to direct sorted output to another command. You can specify input and output files by using redirection symbols (< or >). It can be faster and more efficient (especially with large files) to specify the input file directly (as defined by filename1 in the command syntax), and then specify the output file using the /o parameter.

  • The sort command doesn’t distinguish between uppercase and lowercase letters and has no limit on file size.

  • The sort program uses the collating-sequence table that corresponds to the Country/Region code and code-page settings. Characters greater than ASCII code 127 are sorted based on information in the Country.sys file or in an alternate file specified by the country command in your Config.nt file.

  • If the sort fits within the maximum memory size (as set by default or as specified by the /m parameter), the sort is performed in a single pass. Otherwise, the sort is performed in two separate sort and merge passes, and the amounts of memory used for both passes are equal. When two passes are performed, the partially sorted data is stored in a temporary file on disk. If there is not enough memory to perform the sort in two passes, a run-time error is issued. If the /m command-line option is used to specify more memory than is truly available, performance degradation or a run-time error can occur.

Examples

  • To sort and display, in reverse order, the lines in a file named expenses.txt, type:

      sort /r expenses.txt
    
  • To search a large file named maillist.txt for the text Jones, and to sort the results of the search using the pipe (|) to direct the output of a find command to the sort command, type:

      find Jones maillist.txt | sort
    

    The command produces a sorted list of lines that contain the specified text.

  • To sort keyboard input and display the results alphabetically on the screen, you can first use the sort command with no parameters, by typing:

      sort
    

    Then type the text that you want sorted, and press ENTER at the end of each line. When you have finished typing text, press CTRL+Z, and then press ENTER. The sort command displays the text you typed, sorted alphabetically.

Additional References


MIT License. Copyright (c) 2020-2021 Strontic.