Purpose: | Sort text files, standard output, and the clipboard. |
Format: | XSORT [/= /D /R /unicode=in,out /+n /type=n /length=n] [input files] [/output=filename] |
See also: TPIPE.
Usage:
XSORT sorts text files, standard output, and the clipboard. XSORT supports ASCII, UTF-8, and UTF-16 files, including optionally converting from one encoding format to another.
Anything remaining on the command line after removing the options below is presumed to be one or more input files. If no input file is specified, XSORT will read from standard input. XSORT also supports reading from CLIP:
Options:
/= | Display the XSORT command dialog to help you set the command line options. The /= option can be anywhere on the line; additional options will set the appropriate fields in the command dialog. |
/output | The filename for the sorted output. If the file already exists, it will be overwritten. If no /output=xxx option is specified, XSORT will write to standard output. XSORT also supports writing to CLIP: |
/type | The sort type: |
0 ANSI sort (case insensitive, locale specific)
1 ANSI sort (case sensitive, locale-specific)
2 ASCII sort (case insensitive)
3 ASCII sort (case sensitive)
4 Numeric sort. - Sort according to their numeric value. Leading spaces are allowed. The number must be in decimal, and can be in floating point format. Any non-numeric characters after the number are ignored. If the line has no valid numeric value it is given a value of 0. If you have dates formatted in YYYYMMDDHHMMSS order you can easily sort by date based on the value.
5 Sort by length of line - Note that if you also specify /D, there is no way of knowing which line from a group of lines with the same sort value will be kept. For example, with input of 'AAA', 'BBB', 'CCC' each has a length of 3 and appears to be the same.
6 Sort by date and time - The value must use the current locale’s date/time format. Specifying AM or PM as part of the time is optional, as are the seconds. Use 24-hour time (7:45 PM is entered as 19:45, for example) if AM or PM is not specified.
7 Sort by date - The value must consist of two or three numbers, separated by the character defined by the current's locale's Date Separator. The order for month, day, and year is determined by the current locale. Possible combinations are m/d/y, d/m/y, and y/m/d. If the value contains only two numbers, it is interpreted as a date (m/d or d/m) in the current year.
8 Sort by time - The value must consist of two or three numbers, separated by the character defined by the current's locale's Date Separator. The order for month, day, and year is determined by the current locale. Possible combinations are m/d/y, d/m/y, and y/m/d. If the value contains only two numbers, it is interpreted as a date (m/d or d/m) in the current year.
9 UTF-8 sort (case insensitive)
10 UTF-8 sort (case sensitive)
/D | Remove duplicate lines |
/R | Reverse the sort order |
/+n | The column to start comparisons from (the default is 1). The Start Column field allows you to ignore leading characters before a comparison is made. When the Start Column is 1, and the Length is 4096 or more, the sort is optimized compared to selecting a subset of each line. All lines are compared for their entire width. |
/length=n | The length of the comparison (default is 4096) |
/unicode=in,out | The encoding format. XSORT will auto-detect ASCII, UTF-8, and UTF-16 files, so this option is only necessary if you want the input and output encoding to be different. The options for in and out are: |
UTF-16LE
UTF-16BE
UTF-32LE
UTF-32BE
UTF-8
ANSI
ASCII
CPnnn, where nnn is a Windows code page (for example, CP437 or CP1251).