Created
January 7, 2011 13:55
-
-
Save jnslxndr/769477 to your computer and use it in GitHub Desktop.
Using sed to rename files in more or less one line ;)
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
# for example ".bak" | |
TOKEN=.bak | |
ETOKEN=`echo $TOKEN |sed 's/\./\\\./'` | |
# any suggestions how to get rid of this "bash" at the end are appreciated | |
# also: alternatively there is a NOT opperator on sed's regex - not used here | |
find . -path "*$TOKEN" -d 1 |sed 's/^\.\(.*\)\($ETOKEN\)$/mv `pwd`\1\2 `pwd`\1/'|bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment