Let's say I have a directory with the files
d. I would like to sort the files according to the cs_CZ.UTF8 locale but without ignoring the underscore, ie like this:
_b a c č d.
ls | sort as well) sorts the files like this:
a _b c č d.
All answers I have found suggest using
LC_COLLATE=C, but that changes the ordering to
_b a c d č (notice that
č is now at the end, not between
d as it is supposed to be).
Is there any way to achieve this goal?
Note that I also care about other characters than underscore, ie I would like
a-n.pdf a-p.pdf a.pdf c č d sort in this order and not
a-n.pdf a.pdf a-p.pdf c č d.
a.pdf a-n.pdf a-p.pdf c č d is also fine, as long as the non-alphanumeric characters are not ignored.)
The following are not the answers I am looking for:
LC_COLLATE=Cas explained above,
- using shell expansion such as
ls _*; ls [^_]*because the question is not only about underscores.