SORT /UNIQUE /UNI_OUTPUT...

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
miskox
Posts: 630
Joined: 28 Jun 2010 03:46

SORT /UNIQUE /UNI_OUTPUT...

#1 Post by miskox » 25 Jan 2021 04:30

Here viewtopic.php?p=63727#p63727 Dave mentions /UNIQUE qualifier with the SORT command.

I checked sort.exe. It contains (marked in green are those already displayed with help).

Code: Select all

case_sensitive  
[color=#00BF00]locale
memory
output  
reverse 
record_maximum  
temporary  [/color] 
uni_output  
unique  
TEMP 
path   
srt  
Current qualifiers (displayed as help):

Code: Select all

/+n
/L[OCALE] locale
/M[EMORY] kilobytes
/REC[ORD_MAXIMUM]
/R[EVERSE]
/T[EMPORARY]
/O[UTPUT]
So. I did a test: SORT /UNI_OUTPUT: output file is in Unicode. So there are more:
- TEMP: this might be the new location for the temporary files? It works: /TEMP . probably for current folder
- PATH: ?
- SRT and PATH: invalid switch.

Saso

jfl
Posts: 226
Joined: 26 Oct 2012 06:40
Location: Saint Hilaire du Touvet, France
Contact:

Re: SORT /UNIQUE /UNI_OUTPUT...

#2 Post by jfl » 25 Jan 2021 06:35

I think that TEMP and path are not part of the supported options.
/TEMP worked for you as an abbreviation of the documented /TEMPORARY option.

Also note that contrary to the other options before it, it is part of a longer string "TEMP path":

Code: Select all

C:\Windows\System32>strings sort.exe | ag "[a-z]{4,}"
[Uninteresting garbage]
case_sensitive
locale
memory
output
reverse
record_maximum
temporary
uni_output
unique
TEMP path
<unknown>
[Lots of function names, etc]
C:\Windows\System32>ag -a "TEMP\x20path" sort.exe
Binary file sort.exe matches.

C:\Windows\System32>
So beyond uni_output and unique, the only other undocumented option would be /CASE_SENSITIVE.
I tested it. It is accepted as switch, complete or abbreviated, but does not seem to have any effect:

Code: Select all

C:\Windows\System32>dir /b \ | sort /CASE_SENSITIVE
.pytest_cache
_Backup_Dirs.txt
_Backup_Files.txt
Data
DDA
Downloads
hello.py
inetpub
Intel
JFL
MASM
Mnt
MSVC
old1
PerfLogs
Program Files
Program Files (x86)
Python27amd64
SWSetup
Symbols
Temp
Users
usr
Windows

C:\Windows\System32>

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: SORT /UNIQUE /UNI_OUTPUT...

#3 Post by dbenham » 25 Jan 2021 07:17

jfl wrote:
25 Jan 2021 06:35
So beyond uni_output and unique, the only other undocumented option would be /CASE_SENSITIVE.
I tested it. It is accepted as switch, complete or abbreviated, but does not seem to have any effect:
Sure it has an effect - you just need to understand the collation sequence, and have input that is able to demonstrate the effect.
Just looking at English letters, the /C option sorts primarily by the standard alpha sequence, and in the case of a tie, it sorts lowercase before uppercase.

test.txt

Code: Select all

XYZ
abc
xyz
ABC
Difference without/with /C

Code: Select all

C:\test>sort test.txt
abc
ABC
XYZ
xyz

C:\test>sort /c test.txt
abc
ABC
xyz
XYZ
The difference is even more obvious when you add the /UNIQ option

Code: Select all

C:\test>sort /uniq test.txt
abc
XYZ

C:\test>sort /c /uniq test.txt
abc
ABC
xyz
XYZ

Dave Benham

jfl
Posts: 226
Joined: 26 Oct 2012 06:40
Location: Saint Hilaire du Touvet, France
Contact:

Re: SORT /UNIQUE /UNI_OUTPUT...

#4 Post by jfl » 25 Jan 2021 08:10

Ah, OK!
I expected it would output strings like case-dependent sorts in Unix:

Code: Select all

ABC
XYZ
abc
xyz
I just checked /CASE_SENSITIVE is present in XP and later versions of Windows, but not in Windows 98. Funny I never heard of it.

miskox
Posts: 630
Joined: 28 Jun 2010 03:46

Re: SORT /UNIQUE /UNI_OUTPUT...

#5 Post by miskox » 26 Jan 2021 01:59

jfl wrote:
25 Jan 2021 06:35
So beyond uni_output and unique, the only other undocumented option would be /CASE_SENSITIVE.
I tested it. It is accepted as switch, complete or abbreviated, but does not seem to have any effect:
I missed that (CASE_SENSITIVE) in my original post.

Thanks.
Saso

Post Reply