因此,我在 Linux 机器上有 58 个文件,文件名如下:
Theory of Computation (TOC) | Basics of TOC | Lec 1 | GATE Computer Science⧸IT Engineering Exam [7DOPjYGtnTQ].mp4
Theory of Computation (TOC) | Operations | Lec 2 | GATE Computer Science⧸IT Engineering Exam [XCm43gyfl4M].mp4
Theory of Computation (TOC) | Chomsky Hierarchy | Lec 3 | GATE Computer Science⧸IT Engineering Exam [_YvKlbKmbNg].mp4
每个文件名的讲座编号后面都有“Lec”。我想按以下方式在每个文件上连续添加数字:
1 - Theory of Computation (TOC) | Basics of TOC | Lec 1 | GATE Computer Science⧸IT Engineering Exam [7DOPjYGtnTQ].mp4
2 - Theory of Computation (TOC) | Operations | Lec 2 | GATE Computer Science⧸IT Engineering Exam [XCm43gyfl4M].mp4
3 - Theory of Computation (TOC) | Chomsky Hierarchy | Lec 3 | GATE Computer Science⧸IT Engineering Exam [_YvKlbKmbNg].mp4
我怎样才能做到这一点?
答案1
和zsh
:
autoload -Uz zmv
zmv -n '*| Lec (<->) |*' '$1 - $f'
-n
如果对结果满意,请删除(试运行)。