作者Qiqi (潑潑)
看板Linux
標題[問題] ls像file manager的sort
時間Fri Feb 5 22:19:08 2016
我想用ls列出像是file manager預設的sort的樣子,像是:
0_0.txt
0_1.txt
0_2.txt
.
.
.
0_10.txt
0_11.txt
.
.
.
0_15.txt
1_0.txt
1_1.txt
.
.
.
15_15.txt
單純用sort -n好像沒用,我也google不到好的關鍵字
有請鄉民們提供見解
附上example:
for i in {0..15}
do
for j in {0..15}
do
touch $i"_"$j".txt"
done
done
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.141.184.5
※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1454681951.A.992.html
※ 編輯: Qiqi (223.141.184.5), 02/05/2016 22:19:37
→ kenduest: ls -f $(ls|sort -n) 02/05 22:31
推 ckc1ark: ls | sort -t_ -n -k 1 -k 2 02/05 23:45
→ Qiqi: 原來-k是可以重複帶的,2樓是我要的,謝謝你。 02/06 12:01