击:重命名多个文件小部分名称的中间 [英] Bash: Rename small part of multiple files in middle of name
本文介绍了击:重命名多个文件小部分名称的中间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想改变这种
cc211_AMBER_13062012i.II cc211_GROMOS_13062012i.II
cc211_CHARM_13062012i.II cc211_OPLS_13062012i.II
到
cc211_AMBER_15062012i.II cc211_GROMOS_15062012i.II
cc211_CHARM_15062012i.II cc211_OPLS_15062012i.II
我试过了,
find -name "*.13 *" | xargs rename ".13" ".15"
通常有3个和第二个星号之间没有空格,那只是使它从我所看到的斜体上。基本上有很多关于当它在文件名,其中星号似乎工作的到底是什么做的答案,但在这里我不能让它工作。
There is normally no space between the 3 and the second asterix, thats just makes it italics on from what I can see. Basically there's a lot of answers for what to do when it's at the end of the filename, where asterix seem to work, but here I can't make it work.
任何你已经有了将让我的生活轻松了许多!
Anything you've got would make my life a lot easier!
编辑1:试用
-bash-4.1$ ls
cc211_AMBER_13062012.II cc211_GROMOS_13062012.II
cc211_CHARM_13062012.II cc211_OPLS_13062012.II
-bash-4.1$ rename 's/_13/_15/' cc*
-bash-4.1$ ls
cc211_AMBER_13062012.II cc211_GROMOS_13062012.II
cc211_CHARM_13062012.II cc211_OPLS_13062012.II
谢谢,
查理
推荐答案
这个怎么样:
for i in *.II; do mv $i $(echo $i | sed 's/_13/_15/g'); done
这将在所有的文件替换 _13
与 _15
带扩展名。②
This will replace _13
with _15
in all files with extension .II
更多信息。
这篇关于击:重命名多个文件小部分名称的中间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文