linux命令大全rename,Linux常用命令汇总--rename

rename这个命令是用来修改文件名称的,特别是用来批量修改具有相似格式的文件。

rename 使用格式为:rename待替换的文件字符串 替换后的文件字符串 应用的的范围

可以从例子中理解rename的用法:

1)创建foo1 至foo50 ,foo_1 至foo_50的文件:

for i in `seq 1 50`

do

touch foo${i}

touch foo_${i}

done

6738c045f9a804a2691962d9fd584034.png

spacer.gif

2)将foo_1 至foo_50 修改成test_1至test_50,而foo1 至foo50的名称不变

[root@mycentostest]# rename foo test foo_*

foo1   foo15  foo20  foo26  foo31  foo37  foo42  foo48  foo8     test_13  test_19  test_24  test_3   test_35  test_40  test_46  test_6

foo10  foo16  foo21  foo27  foo32  foo38  foo43  foo49  foo9     test_14  test_2   test_25  test_30  test_36  test_41  test_47  test_7

foo11  foo17  foo22  foo28  foo33  foo39  foo44  foo5   test_1   test_15  test_20  test_26  test_31  test_37  test_42  test_48  test_8

foo12  foo18  foo23  foo29  foo34  foo4   foo45  foo50  test_10  test_16  test_21  test_27  test_32  test_38  test_43  test_49  test_9

foo13  foo19  foo24  foo3   foo35  foo40  foo46  foo6   test_11  test_17  test_22  test_28  test_33  test_39  test_44  test_5

foo14  foo2   foo25  foo30  foo36  foo41  foo47  foo7   test_12  test_18  test_23  test_29  test_34  test_4   test_45  test_50

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值