Schleusener, Jens
2014-08-01 09:38:39 UTC
Hi,
I am not sure if it's a bug or not but for my application cases the "sort"
command with use of the very helpful option "-V" (natural sort of
(version) numbers within text) not always delivers the by me expected
output.
Example input file (with four test cases):
1.0.5_src.tar.gz
1.0_src.tar.gz
2.0.5src.tar.gz
2.0src.tar.gz
3.0.5/
3.0/
4.0.5beta/
4.0beta/
Sorted ("sort -V") output file (with errors?):
1.0.5_src.tar.gz
1.0_src.tar.gz
2.0src.tar.gz
2.0.5src.tar.gz
3.0.5/
3.0/
4.0beta/
4.0.5beta/
By me expected output file:
1.0_src.tar.gz
1.0.5_src.tar.gz
2.0src.tar.gz
2.0.5src.tar.gz
3.0/
3.0.5/
4.0beta/
4.0.5beta/
You see that the sort works correctly if after the [0-9\.]* part follows
a alphabetic character but not if follows a non-alphabetic character like
a slash or an underscore.
Regards
Jens
I am not sure if it's a bug or not but for my application cases the "sort"
command with use of the very helpful option "-V" (natural sort of
(version) numbers within text) not always delivers the by me expected
output.
Example input file (with four test cases):
1.0.5_src.tar.gz
1.0_src.tar.gz
2.0.5src.tar.gz
2.0src.tar.gz
3.0.5/
3.0/
4.0.5beta/
4.0beta/
Sorted ("sort -V") output file (with errors?):
1.0.5_src.tar.gz
1.0_src.tar.gz
2.0src.tar.gz
2.0.5src.tar.gz
3.0.5/
3.0/
4.0beta/
4.0.5beta/
By me expected output file:
1.0_src.tar.gz
1.0.5_src.tar.gz
2.0src.tar.gz
2.0.5src.tar.gz
3.0/
3.0.5/
4.0beta/
4.0.5beta/
You see that the sort works correctly if after the [0-9\.]* part follows
a alphabetic character but not if follows a non-alphabetic character like
a slash or an underscore.
Regards
Jens