如何删除文件名中可用的数字?
在下面的示例中,您可以看到我想删除零
$ rename -n 's/Season\ (\d{2})\ Episode\ (\d{2}).+(\D{2})/Season\ $1\ Episode\ $2.mp4/' *
Season 01 Episode 01.mp4 renamed as Season 01 Episode 01.mp44
Season 01 Episode 02.mp4 renamed as Season 01 Episode 02.mp44
Season 01 Episode 03.mp4 renamed as Season 01 Episode 03.mp44
Season 01 Episode 04.mp4 renamed as Season 01 Episode 04.mp44
Season 01 Episode 05.mp4 renamed as Season 01 Episode 05.mp44
Season 01 Episode 06.mp4 renamed as Season 01 Episode 06.mp44
Season 01 Episode 07.mp4 renamed as Season 01 Episode 07.mp44
Season 01 Episode 08.mp4 renamed as Season 01 Episode 08.mp44
Season 01 Episode 09.mp4 renamed as Season 01 Episode 09.mp44
Season 01 Episode 10.mp4 renamed as Season 01 Episode 10.mp44
Season 01 Episode 11.mp4 renamed as Season 01 Episode 11.mp44
Season 01 Episode 12.mp4 renamed as Season 01 Episode 12.mp44
Season 01 Episode 13.mp4 renamed as Season 01 Episode 13.mp44
Season 01 Episode 14.mp4 renamed as Season 01 Episode 14.mp44
Season 01 Episode 15.mp4 renamed as Season 01 Episode 15.mp44
Season 01 Episode 16.mp4 renamed as Season 01 Episode 16.mp44
Season 01 Episode 17.mp4 renamed as Season 01 Episode 17.mp44
Season 01 Episode 18.mp4 renamed as Season 01 Episode 18.mp44
Season 01 Episode 19.mp4 renamed as Season 01 Episode 19.mp44
Season 01 Episode 20.mp4 renamed as Season 01 Episode 20.mp44
Season 01 Episode 21.mp4 renamed as Season 01 Episode 21.mp44
Season 01 Episode 22.mp4 renamed as Season 01 Episode 22.mp44
Season 01 Episode 23.mp4 renamed as Season 01 Episode 23.mp44
Season 01 Episode 25.mp4 renamed as Season 01 Episode 25.mp44
Season 01 Episode 26.mp4 renamed as Season 01 Episode 26.mp44
Season 02 Episode 00.mp4 renamed as Season 02 Episode 00.mp44
Season 02 Episode (this zero needs to be removed)***0***15.mp4 renamed as Season 02 Episode 01.mp44
Season 02 Episode ***0***16.mp4 renamed as Season 02 Episode 01.mp44
Season 02 Episode ***0***17.mp4 renamed as Season 02 Episode 01.mp44
Season 02 Episode ***0***18.mp4 renamed as Season 02 Episode 01.mp44
Season 02 Episode ***0***19.mp4 renamed as Season 02 Episode 01.mp44
Season 02 Episode 01.mp4 renamed as Season 02 Episode 01.mp44
Season 02 Episode ***0***20.mp4 renamed as Season 02 Episode 02.mp44
Season 02 Episode ***0***21.mp4 renamed as Season 02 Episode 02.mp44
Season 02 Episode 02.mp4 renamed as Season 02 Episode 02.mp44
Season 02 Episode 03.mp4 renamed as Season 02 Episode 03.mp44
Season 02 Episode 04.mp4 renamed as Season 02 Episode 04.mp44
Season 02 Episode 05.mp4 renamed as Season 02 Episode 05.mp44
Season 02 Episode 06.mp4 renamed as Season 02 Episode 06.mp44
Season 02 Episode 07.mp4 renamed as Season 02 Episode 07.mp44
Season 02 Episode 08.mp4 renamed as Season 02 Episode 08.mp44
Season 02 Episode 09.mp4 renamed as Season 02 Episode 09.mp44
Season 02 Episode 10.mp4 renamed as Season 02 Episode 10.mp44
Season 02 Episode 11.mp4 renamed as Season 02 Episode 11.mp44
Season 02 Episode 12.mp4 renamed as Season 02 Episode 12.mp44
Season 02 Episode 13.mp4 renamed as Season 02 Episode 13.mp44
Season 02 Episode 14.mp4 renamed as Season 02 Episode 14.mp44
正如您所看到的,扩展名也没有正确重命名,使用 rename 命令。我也知道重命名命令是错误的,所以请提供正确的命令。
以下更简单的表达式可能就足够了:
0*
来捕捉两位数剧集编号之前的额外 0。