JSORT.BAT v4.2 - Case sensitive sort with option for numeric sort
Moderator: DosItHelp
Re: JSORT.BAT - Case sensitive sort with option for numeric
applaud your effort in creating a "native" solution to sort, however, a compiled tool is always "faster" than a script engine. There's a GNU win32 sort in http://gnuwin32.sourceforge.net/packages/coreutils.htm, also, windows have sort as well..
Re: JSORT.BAT - Case sensitive sort with option for numeric
goldfish wrote:applaud your effort in creating a "native" solution to sort,
Yes, it's very useful with the various options, and especially for people that cannot install third party tools due to policies.
however, a compiled tool is always "faster" than a script engine. There's a GNU win32 sort in http://gnuwin32.sourceforge.net/packages/coreutils.htm, also, windows have sort as well..
Dave's tool can also do things that Windows sort is unable to do.
Re: JSORT.BAT - Case sensitive sort with option for numeric
goldfish wrote:applaud your effort in creating a "native" solution to sort, however, a compiled tool is always "faster" than a script engine. There's a GNU win32 sort in http://gnuwin32.sourceforge.net/packages/coreutils.htm, also, windows have sort as well..
There are always reasons why people write the scripts that they do. It wasn't about speed. It was about functionality. If you read Dave's original post I think he explains that very well.
Hi Brian.
Re: JSORT.BAT - Case sensitive sort with option for numeric
Not forgetting that modern Windows also comes with Powershell installed by default. I am sure one could also use that power for sorting. http://technet.microsoft.com/en-us/libr ... 76968.aspx
Re: JSORT.BAT - Case sensitive sort with option for numeric
goldfish wrote:Not forgetting that modern Windows also comes with Powershell installed by default. I am sure one could also use that power for sorting. http://technet.microsoft.com/en-us/libr ... 76968.aspx
The other main point of JSORT is that it is a hybrid BATCH/Jscript. Hard to do that with powershell. There is a running thread about that topic.
Re: JSORT.BAT - Case sensitive sort with option for numeric
Squashman wrote:goldfish wrote:Not forgetting that modern Windows also comes with Powershell installed by default. I am sure one could also use that power for sorting. http://technet.microsoft.com/en-us/libr ... 76968.aspx
The other main point of JSORT is that it is a hybrid BATCH/Jscript. Hard to do that with powershell. There is a running thread about that topic.
Why would powershell need a hybrid? I don't understand.
Re: JSORT.BAT - Case sensitive sort with option for numeric
goldfish wrote:Why would powershell need a hybrid? I don't understand.
Please ask that question in this thread.
viewtopic.php?f=3&t=5543
Or this thread.
viewtopic.php?f=3&t=5526
Re: JSORT.BAT - Case sensitive sort with option for numeric
Squashman wrote:Hi Brian.
Bingo.
Re: JSORT.BAT - Case sensitive sort with option for numeric
foxidrive wrote:Squashman wrote:Hi Brian.
Bingo.
what's up long time no see hope you missed me.
Re: JSORT.BAT - Case sensitive sort with option for numeric
Remove that hybrid and do everything in jscript or vbscript. running in one process is better than spawning different processes.
Re: JSORT.BAT - Case sensitive sort with option for numeric
Dave, given data like this:
Can jsort use a negative token so that the names can be sorted by the date terms and it returns this?
I haven't looked at the code to see how you've implemented it - thought you might like the idea to add to Jsort.
Code: Select all
Cat on a hot tin roof (2003).txt
101 (nutty) dalmations (1996).txt
Short Circuit (1999).txt
Can jsort use a negative token so that the names can be sorted by the date terms and it returns this?
Code: Select all
101 (nutty) dalmations (1996).txt
Short Circuit (1999).txt
Cat on a hot tin roof (2003).txt
I haven't looked at the code to see how you've implemented it - thought you might like the idea to add to Jsort.
Re: JSORT.BAT - Case sensitive sort with option for numeric
Good idea - I may implement that feature in the near future.
But until then, you can still easily get your desired result if you preprocess the text with JREPL to encode all token delimiters except for the last one, do the sort, and then use JREPL to decode the original delimiters:
Dave Benham
But until then, you can still easily get your desired result if you preprocess the text with JREPL to encode all token delimiters except for the last one, do the sort, and then use JREPL to decode the original delimiters:
Code: Select all
jrepl "\\ \((?=.*\()" "\s \p" /t " " /f test.txt | jsort /d "(" /t 2 | jrepl "\\s \\p" "\ (" /t " "
Dave Benham
Re: JSORT.BAT - Case sensitive sort with option for numeric
Much appreciated Dave!
After checking what each segment does I'm a little curious why the slashes were encoded.
There's an anomaly though too - can you see why these items sorted in this way?
The alpha sort at the beginning of the line isn't quite right, but it does do an admirable job and is fine for what I need it for.
I changed the extensions to keep it more low key, but they are avi and mkv and the first character is correct.
After checking what each segment does I'm a little curious why the slashes were encoded.
There's an anomaly though too - can you see why these items sorted in this way?
Code: Select all
Alpha and Omega (2010).aaa
A-Team, The (2010).mmm
Alice in Wonderland (2010).mmm
Alien Raiders (2010).mmm
All Good Things (2010).mmm
Arctic Predator (2010).mmm
The alpha sort at the beginning of the line isn't quite right, but it does do an admirable job and is fine for what I need it for.
I changed the extensions to keep it more low key, but they are avi and mkv and the first character is correct.
Re: JSORT.BAT - Case sensitive sort with option for numeric
foxidrive wrote:There's an anomaly though too - can you see why these items sorted in this way?Code: Select all
Alpha and Omega (2010).aaa
A-Team, The (2010).mmm
Alice in Wonderland (2010).mmm
Alien Raiders (2010).mmm
All Good Things (2010).mmm
Arctic Predator (2010).mmm
The alpha sort at the beginning of the line isn't quite right, but it does do an admirable job and is fine for what I need it for.
My suggestion is it's sorting priorities are year, alphabet extension, alphabet name
Re: JSORT.BAT - Case sensitive sort with option for numeric
Just in case the source file alredy contains slashes. I know they are not present in your example, but it could happen, especially if your file contains full paths instead of just file names.foxidrive wrote:After checking what each segment does I'm a little curious why the slashes were encoded.
foxidrive wrote:There's an anomaly though too - can you see why these items sorted in this way?Code: Select all
Alpha and Omega (2010).aaa
A-Team, The (2010).mmm
Alice in Wonderland (2010).mmm
Alien Raiders (2010).mmm
All Good Things (2010).mmm
Arctic Predator (2010).mmm
The alpha sort at the beginning of the line isn't quite right, but it does do an admirable job and is fine for what I need it for.
I changed the extensions to keep it more low key, but they are avi and mkv and the first character is correct.
I don't see the problem. The /T option does not specify that only one token is sorted. It simply is part of the equation that determines the beginning position that is used for sorting. Each line is sorted based on the year through the end of the line. The content before the year is simply ignored. Of course (2010).aaa sorts before (2010).mmm. But all files that end with (2010).mmm are ties and the order for them is undefined.
I briefly toyed with the idea of adding a feature where JSORT could parse each line into multiple fields, and then you could specify the sort order and precedence for each field individually. But I quickly abandoned that line of thought and opted to keep it simple.
Dave Benham