Sujet : Re: Numerically sorted arguments (in shell)
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.unix.shellDate : 20. Jun 2024, 05:43:13
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v50c12$2dtrs$1@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 20.06.2024 01:45, vallor wrote:
[...]
I finally remembered which tool has "versionsort(3)" -- it's ls:
$ ls -1
test10.txt
test1.txt
test2.txt
$ ls -v -1
test1.txt
test2.txt
test10.txt
Does that help?
Sure, thanks. - Just remember that it's a non-standard option. But
for my GNU environment it's certainly a usable part of the solution.
It seems to also handle multiple numeric components as desired (as
versions usually have)
$ ls | shuf | xargs ls -v
1 1.2 1.11 2.1 2.10 10.1 10.10 11.1
1.1 1.10 2 2.2 2.11 10.2 10.11 11.2
Janis