4 ms·
Natural sort is an Option in sort(1): for i in $(seq 2 10) ; do touch img_$i-hn.txt done ls img_* | sort -V img_2-hn.txt img_3-hn.txt img_4-hn
by jcynix 1y ago
Natural sort is an Option in sort(1):
for i in $(seq 2 10) ; do
touch img_$i-hn.txt
done
ls img_* | sort -V
img_2-hn.txt
img_3-hn.txt
img_4-hn.txt
img_5-hn.txt
img_6-hn.txt
img_7-hn.txt
img_8-hn.txt
img_9-hn.txt
img_10-hn.txt
And we have "sort -h" to sort the output of e.g. "du -sh *" properly.
Edit: formatting and add sort -h