You are not logged in.
Is it possible to have the ls command sort the entries in natural order if they start with numbers but still be case insensitive if they start with characters?
-v natural sort of (version) numbers within text
But this not only changes sorting for numbers but also how other letters are handled.
$ ls -l
total 0
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:25 01-file
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:25 02-file
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:25 03-file
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:26 10-file
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:26 11-file
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:26 1-file
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 a
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 A
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 b
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 B
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 c
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 C
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 d
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 D1-file is placed after the 0x-files. I want it to be right between 01 and 02.
The non numeric ones are sorted case insensitive.
$ ls -lv
total 0
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:25 01-file
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:26 1-file
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:25 02-file
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:25 03-file
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:26 10-file
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:26 11-file
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 A
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 B
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 C
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 D
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 a
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 b
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 c
-rw-r--r-- 1 lukas lukas 0 15. Aug 10:27 dHere the numbers are sorted the way I'd like but now all uppercase letters are placed before the lowercase letters which I don't want.
Is this affected by the LC_COLLATE setting? If so, where can I find documentation on customizing it? The wiki section seems not very helpful in this case.
$ locale
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC=en_US.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.utf8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.utf8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=I put at button on it. Yes. I wish to press it, but I'm not sure what will happen if I do. (Gune | Titan A.E.)
Offline
$ LC_COLLATE=C ls -v
00 01 1 02 2 3but
$ LC_COLLATE=C ls -v
00 01 1 02 2 3 A B C a b cLast edited by karol (2015-08-15 08:53:36)
Offline
Okay, so what I'd like is a sorting like this:
00 01 1 02 2 3 a A b B c CIt seems that
LC_COLLATE="en_US.utf8"makes the aA part possible but when using the -v option it behaves like LC_COLLATE=C where all uppercase letters are first and then all lowercase letters.
I put at button on it. Yes. I wish to press it, but I'm not sure what will happen if I do. (Gune | Titan A.E.)
Offline