如何将多个文件名中的一部分从1更改为01? [英] how to change a part in multiple filenames from 1 to 01?

查看:229
本文介绍了如何将多个文件名中的一部分从1更改为01?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目录中有很多文件.

I have lots of files in a directory.

示例:

 "/data/2014/file300.data.20141231.MC.9.vgf.img"

此处9表示小时,从1 to 24开始更改,日期也更改. 小时表示为.1. .2. .3. .4. .... .9. 我想用.01. .02. .03. .04. .... .09.替换文件名中的该部分(仅此部分),并且不要触摸文件名中的任何其他数字.

here 9 represent the hour and change from 1 to 24,the date also change. the hours are represented .1. .2. .3. .4. .... .9. I want to replace this part(only this part) in the file name with .01. .02. .03. .04. .... .09. and do not touch any other number in the file name.

所以.1.变成.01.等等

so .1. become .01. and so on

推荐答案

尝试使用Larry Wall的rename.MC.替换为.MC.0:

Try this with Larry Wall's rename to replace .MC. by .MC.0:

rename 's/\.MC\./.MC.0/' /data/2014/*.img

这篇关于如何将多个文件名中的一部分从1更改为01?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆