Created
February 8, 2014 00:30
-
-
Save kimchaily/8874760 to your computer and use it in GitHub Desktop.
Batch renaming in Terminal (e.g. bash) using RegEx
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
// Example: replace every capital letter with 'abc', only changing m4a-files | |
for file in *.m4a ; do mv -vf "$file" "`echo $file | sed -E 's/[A-Z]/abc/g'`" ; done | |
// Sublime-Text snippet: | |
<snippet> | |
<content><![CDATA[ | |
for file in *.${1:m4a} ; do mv -vf "\$file" "`echo \$file | sed -E 's/${2:[A-Z]}/${0:abc}/g'`" ; done | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>rename</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<!-- <scope>source.python</scope> --> | |
</snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment