6
votes
Accepted
Why is ls sorting Chinese filenames by length?
You'll notice that among the strings of same length, there appears to be a relative order of those characters, so they're not totally treated as being equivalent. It's not like the 🧚🧛🧜 which have ...
3
votes
How to sort the list of positional parameters in POSIX sh
Probably easiest is to resort to awk which can do strcoll(), strcmp(), and number comparisons (including of floating points).
To avoid reinventing the wheel, we can use the quicksort awk ...
2
votes
How to sort the list of positional parameters in POSIX sh
you need to use the shell to eval these string first, and then can sort the results, applying the same operations to the strings that get sorted, and the array of original indices. I'll illustrate ...
2
votes
How exactly does Nautilus sort files by name?
By default, 'ls' uses the libc locale-specific sort order, the same as used by 'sort'. For all *.UTF-8 locales (except C.UTF-8), Glibc implements the Unicode Collation Algorithm (or something close to ...
1
vote
Accepted
Display the results in an alphabetical order, independently of their case
ls is required by POSIX to sort the file names in its output according to the collating sequence in the current locale.
If your system has no locale where the sort order ignores case at least in the ...
1
vote
Why is ls sorting Chinese filenames by length?
I found out where macOS stores locale files, in /usr/share/locale, and to my surprise this is how the zh_CN.UTF-8 locale is defined:
% ls -la /usr/share/locale/zh_CN.UTF-8
total 8
drwxr-xr-x 8 root ...
1
vote
Shell script to find and copy files from a painfully large unsorted folder
Mention of File Explorer makes me wonder if you're using Windows, and perhaps then that bash is running within cygwin. If this were the case, the cygwin intermediate layer may possibly be making the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sort × 1003text-processing × 173
awk × 134
linux × 115
bash × 110
shell-script × 85
uniq × 74
ls × 67
shell × 62
files × 62
grep × 61
find × 52
sed × 46
command-line × 43
locale × 35
filenames × 33
date × 33
scripting × 22
csv × 22
numeric-data × 20
join × 19
pipe × 18
cut × 17
macos × 16
unicode × 16