$ dir
Magi The Labyrinth Of Magic Episode 1 English Dubbed.mp4
Magi The Labyrinth Of Magic Episode 2 English Dubbed.mp4
Magi The Labyrinth Of Magic Episode 3 English Dubbed.mp4
Magi The Labyrinth Of Magic Episode 4 English Dubbed.mp4
Magi The Labyrinth Of Magic Episode 5 English Dubbed.mp4
Magi The Labyrinth Of Magic Episode 6 English Dubbed.mp4
Magi The Labyrinth Of Magic Episode 6 English Dubbed.mp4-1.part
$ rename -n 's/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ {1..5}.+mp4/MTLOM\ \(DUB\)\ 0*{1..5}.mp4/g' *
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ { <-- HERE 1..5}+mp4/ at (eval 1) line 1.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ { <-- HERE 1..5}+mp4/ at (eval 2) line 1.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ { <-- HERE 1..5}+mp4/ at (eval 3) line 1.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ { <-- HERE 1..5}+mp4/ at (eval 4) line 1.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ { <-- HERE 1..5}+mp4/ at (eval 5) line 1.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ { <-- HERE 1..5}+mp4/ at (eval 6) line 1.
我想重命名一些文件而不是其他文件;在 30 个文件中,要忽略的文件是第六个 6、16、8、28 和 19。
如果总共有 30 个文件,要重命名文件 6、8、16、19 和 28 以外的所有文件:
用于
()
保存模式并$1
引用它。我不确定您希望0*
替换的 发生什么 - 我只是把它拿出来了。根据需要进行调整。我拿出了不必要的逃跑
正则表达式注意事项
-
[^68][^689]?|18|26|29
匹配任何 char but6
or8
可选地后跟任何 char but6
,8
, or9
, or, match18
, or, match26
, or, match29
。不是很优雅...