View Full Version : unix sort utility for windows; configurable delimiter
05-27-2005, 04:13 PM
I have searched without success for a sort utility for windows with a configurable delimiter. In unix, you set the field delimiter when sorting data with multiple fields, but the windows version of sort does not seem to allow that.
05-27-2005, 04:35 PM
Are you talking about a command line sort function? If so, I'd downlaod cygwin. It allows you to run unix commands on windows.
05-27-2005, 04:39 PM
Yes, I have cygwin. I am trying to make a .bat file calling gawk a few times, and there is a step that requires sorting on a vertical bar. I can't depend that the user will have cygwin installed.
I am surprised that I could not find a nice little shareware utility that does this, or that windows sort does not allow configuring the delimiter.
05-27-2005, 04:57 PM
I dont think there is a utility for this correct if I am wrong though.
05-27-2005, 05:34 PM
I was able to solve the probelm using multiple calls to sort, ren, and rem. Here is the unix line:
sort -t\| +0n -1n +1 -2 file1 file1 > sorted
and here is the windows version:
sort /+1n file1 > sorted
sort /+1n file2 >> sorted
sort /+1n sorted >temp
ren temp sorted
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.