Created
January 13, 2015 11:21
-
-
Save allanesquina/82326118e9dcd73974e2 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# ./renamefiles.sh directory | |
# | |
ls *$1 | egrep 'regex here+' \ | |
| while read f | |
do | |
# if you need remove some character | |
tna=$(echo $f | sed 's/regex here//') | |
echo "$1/$f" "$1/$tna" | |
# mv "$1/$f" "$1/$tna" | |
# if you need replace some character | |
echo "$1/$f" "$1/${f/old/new}" | |
# mv "$1/$f" "$1/${tna/old/new}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment