linux - 如何使用特定模式重命名一堆文件

标签 linux

我想重命名以这种模式命名的目录中的文件:

string1-number.html

例如:

English-5.html

我想做的是像这样重命名文件:

string2-number.string3

例如:

Dictionary-5.en

我该怎么做? 我使用了这个脚本,但没有任何反应:

echo "English-5.html" | sed   's%\({English}\).\(\.*\)\(html\)%dictionary\2\en%'

最佳答案

我建议使用 mmv 工具:http://linux.dsplabs.com.au/mmv-copy-append-link-move-multiple-files-under-linux-shell-bash-by-wildcard-patterns-p5/

你可以这样做:

mmv *-*.html Dictionary-#2.en 

关于linux - 如何使用特定模式重命名一堆文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11175482/

相关文章:

php - 每天 cron 备份购物车 HTML javascript 图片文件

Linux - 如何将一组文件和一个可执行文件压缩为一个唯一的可执行文件

linux - 从源代码构建 tmux

c++ - exit() 函数无法退出进程

linux - 如何找到正在运行的jar文件的路径

c++ - pthreads的性能差异

linux - 如何通过 SSH/PuTTY (Debian) 将 cronjobs 从 root 分配给另一个用户?

c - 在 shmdt() 之后和 shmctl(shmid, ipc_RMID, 0) 之前访问进程中的共享内存

linux - 在 Debian : could not find library containing RSA_new 上构建 Subversion 1.5.4

linux - 通过交互式 shell 与脚本查找名称中带有星号 (*) 的文件