Welcome 微信登录

首页 / 操作系统 / Linux / Linux Shell文件集体重命名的方法

Linux文件单个重命名一般用mv命令,集体重命名很多人自己写一个简单脚本,但是其实Linux的rename命令可以简单实现绝大多数的重命名任务。man rename结果如下:NAMErename - Rename filesSYNOPSISrename from to file...DESCRIPTIONrename will rename the specified files by replacing the first occurrence of from in their name by to.For example, given the files foo1, ..., foo9, foo10, ..., foo278, the commandsrename foo foo0 foo?rename foo foo0 foo??will turn them into foo001, ..., foo009, foo010, ..., foo278.Andrename .htm .html *.htmwill fix the extension of your html files.比如我有三个文件:hs_ok_all_200911.txths_ok_all_a.txths_ok_all_b.txt我需要将所有的hs_ok_all改为hs则使用rename hs_ok_all hs hs_ok_all_*即可。所以rename的第一个参数是要改的部分, 第二个参数是改后的结果,第三个参数是需要改的文件(含通配符)。在Windows7下从硬盘安装 RedHat5.4 方法解决Ubuntu运行命令"APT-GET UPDATE"时" 404 NOT FOUND’错误相关资讯      shell  Linux Shell 
  • Linux基础知识:shell基础命令  (今 10:39)
  • Linux系统监控shell脚本  (04月09日)
  • Linux Shell实现批量关闭局域网中  (03月10日)
  • Linux shell数组  (07月26日)
  • Linux入门学习:认识shell和bash  (03月25日)
  • Linux shell脚本编程  (03月01日)
本文评论 查看全部评论 (0)
表情: 姓名: 字数