I have a txt file with values like this:
3.6.4.2
3.6.5.1
3.6.5.10
3.6.5.11
3.6.5.12
3.6.5.13
3.6.5.2
3.6.7.1
3.6.7.10
3.6.7.11
3.6.7.2
3.6.7.3
I need to write a batch script and return a sorted output. The problem is with last column, numbers .10 and .11 should go after .3 and so. I need the "latest version" to be on the bottom, which in this case is 3.6.7.11
In Linux I used "sort -t"." -k1n,1 -k2n,2 -k3n,3 -k4n,4" but I can't get it working with batch script.
Also I am not allowed to use Cygwin or PowerShell for some reasons.
In my batch code I am so far trying only various versions of this but nothing is working for me:
sort /+n versions.txt
The output used in this question is simply
sort versions.txt
It looks like that command sort is doing it correctly until I don't have 2 digits number used.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…