Last active
December 24, 2015 13:48
-
-
Save mikesorae/6807406 to your computer and use it in GitHub Desktop.
zero padding one-liner for underscore separated file name e.g.
foo_1_bar.jpg
foo_2_bar.jpg ↓ foo_001_bar.jpg
foo_002_bar.jpg
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
ls | ruby -n -e '/([^_]*_)([^_]*)(_.*)/ =~ $_; puts "%s%03d%s"%[$1, $2, $3]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment