Last active
April 9, 2018 23:33
-
-
Save umegaya/bffac13604c0022efe2b2d108f05de3f to your computer and use it in GitHub Desktop.
特定のディレクトリ以下のファイルをsedの置換機能を使って複雑なリネームする
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
find $SEARCH_DIR -name "$FILE_PATTERN" -exec sh -c 'echo mv "$1" "$(echo "$1" | sed s/$PATTERN/$REPLACE/)"' _ {} \; | |
複数引数の例 | |
for i in {2..12} ; do | |
find . -name "food[1-6].png" -exec sh -c 'cp "$1" "$(echo "$1" | sed s#food#$2/food_$2_#)"' _ {} $i \; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment