Last active
December 25, 2018 02:49
-
-
Save kazuhito-m/513b8fd56be12b0aa435ed02b5f6665d to your computer and use it in GitHub Desktop.
ファイル名が「先頭8文字数値」の場合にアンダーバーを付与するbashスクリプト
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/bash | |
# 「ファイル名の先頭が8ケタの数値」の名前のファイルに | |
# 数値とその次の文字の間にアンダーバーを挟んだ名前にリネームするスクリプト。 | |
for i in $(ls | grep '^[0-9]\{8\}') ; do | |
newname=`echo $i | sed -e 's/^\([0-9]\{8\}\)/\1_/g'` | |
mv ${i} ${newname} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment