ka2n blog

Technology and beer

1, 2, 3, 11, 12 みたいな数字をソートする

$ ls
123_1.txt
123_11.txt
123_12.txt
123_13.txt
123_2.txt
123_3.txt
$ ls | sort -t '_' -k 2n
123_1.txt
123_2.txt
123_3.txt
123_11.txt
123_12.txt
123_13.txt