我的清单是:
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