我的名单是:如何排序列表,同时优先考虑数字之前的字母表?
set list {23 12 5 20 one two three four}
预期输出是递增的顺序,不同的是,字母需要在开始的时候放:
four one three two 12 20 23 5
我试过如下:
# sorting the list in increasing order:
lsort -increasing $list
-> 12 20 23 5 four one three two
# Here i get the result with numbers first as the ascii value of numbers are higher than alphabets.
lsort -decreasing $list
# -> two three one four 5 23 20 12
您是否也想作为数字排序,而不是作为字符串的数字吗? (即12之前5) – 2013-03-18 13:02:07