fork(1) download
import re
s=r"""武士彌助_S01E01_浪人.mp4
武士彌助_S01E02_老方法.mp4
武士彌助_S01E03_彌天大罪.mp4
武士彌助_S01E04_漫漫長路.mp4
武士彌助_S01E05_痛楚與鮮血.mp4
武士彌助_S01E06_平衡.mp4"""
 
ms = r"(?P<t>.+?)_S(?P<s>\d+)E(?P<e>\d+)_(?P<sub>.*?)\s?(?P<f>(?:.(?!\.))+$)"
a = [_ for _ in list(filter(None, s.split('\n')))]
b = ['EP{} {}{}'.format(m.group('e').zfill(2), m.group('sub'), m.group('f')).strip().upper() for m in [re.match(ms,_) for _ in a]]
 
for _ in zip(a, b):
	print('ren "{}" "{}"'.format(_[0],_[1]))

Success #stdin #stdout 0.02s 9480KB
stdin
Standard input is empty
stdout
ren "武士彌助_S01E01_浪人.mp4" "EP01 浪人.MP4"
ren "武士彌助_S01E02_老方法.mp4" "EP02 老方法.MP4"
ren "武士彌助_S01E03_彌天大罪.mp4" "EP03 彌天大罪.MP4"
ren "武士彌助_S01E04_漫漫長路.mp4" "EP04 漫漫長路.MP4"
ren "武士彌助_S01E05_痛楚與鮮血.mp4" "EP05 痛楚與鮮血.MP4"
ren "武士彌助_S01E06_平衡.mp4" "EP06 平衡.MP4"