Created
January 19, 2012 16:16
-
-
Save yatt/1640900 to your computer and use it in GitHub Desktop.
sort filenames with number (not aligned)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # 桁揃えされていないファイル(ex. 1.jpg,...,10.jpg,...etc) | |
| # を数値順に表示する。 | |
| # | |
| /bin/ls -1 $1 \ | |
| | tee /tmp/ls.txt \ | |
| | egrep -o '[0-9]+' \ | |
| | awk '{printf("%010d\n",$_)}' \ | |
| | paste - /tmp/ls.txt \ | |
| | sort -k1 \ | |
| | cut -f2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment