$ rename -n 's/(.{10}).*(\.jpg)$/$1$2/' *.jpg
The -n option only simulates the command, so that you can verify the changes. Run without it to actually make the changes.
The regex (.{10}).*(\.jpg) consists:
.{10} - any 10 characters, in a group (…), followed by
.* - any number of any characters followed by
\.jpg$ - the extension at the end ($) of the filename, in the second group
The replacement $1$2 is just the first group followed by the second.
No comments:
Post a Comment