Created
September 11, 2024 18:11
-
-
Save monadplus/73d87dc021346aac9a2ddc211a2055f4 to your computer and use it in GitHub Desktop.
Rename files using a pattern
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/sh | |
for f in *mkv; do | |
source="$f" | |
target=$(echo "$f" | sed -r 's/Modern Family S([[:digit:]]+)E([[:digit:]]+)[^.]*.mkv/Modern Family S\1E\2.mkv/') | |
echo "$source => $target" | |
mv "$source" "$target" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment