一、引言

今天才知道Linux下的rename有两个版本,util-linux工具集的rename和Perl版本的rename,而两者的用法是明显不一样的,Perl版rename相对比较强大

二、对比

perl-rename

RENAME()                                                         Perl Programmers Reference Guide                                                        RENAME()

NAME
rename - renames multiple files SYNOPSIS
rename [ -v ] [ -n ] [ -f ] perlexpr [ files ] DESCRIPTION
"rename" renames the filenames supplied according to the rule specified as the first argument. The perlexpr argument is a Perl expression which is expected
to modify the $_ string in Perl for at least some of the filenames specified. If a given filename is not modified by the expression, it will not be
renamed. If no filenames are given on the command line, filenames will be read via standard input. For example, to rename all files matching "*.bak" to strip the extension, you might say rename 's/\.bak$//' *.bak To translate uppercase names to lower, you'd use rename 'y/A-Z/a-z/' * OPTIONS
-v, --verbose
Verbose: print names of files successfully renamed. -n, --no-act
No Action: show what files would have been renamed. -f, --force
Force: overwrite existing files. ENVIRONMENT
No environment variables are used. AUTHOR
Larry Wall SEE ALSO
mv(), perl() DIAGNOSTICS
If you give an invalid Perl expression you'll get a syntax error. BUGS
The original "rename" did not check for the existence of target filenames, so had to be used with care. I hope I've fixed that (Robin Barker). perl v5.18.2 -- RENAME()

可以看到它的使用方法是 rename [ -v ] [ -n ] [ -f ] perlexpr [ files ] 支持perl正则表达式的,这就是它强大的原因

util-linux-rename

RENAME()                  Linux Programmer’s Manual                 RENAME()

NNAAMMEE
rename - Rename files SYNOPSIS
rename from to file...
rename -V DESCRIPTION
rename will rename the specified files by replacing the first occurrence of from in their name by to. -V, --version
Display version information and exit. For example, given the files
foo1, ..., foo9, foo10, ..., foo278, the commands rename foo foo0 foo?
rename foo foo0 foo?? will turn them into foo001, ..., foo009, foo010, ..., foo278. And
rename .htm .html *.htm will fix the extension of your html files. SEE ALSO
mmv(), mv() AVAILABILITY
The rename command is part of the util-linux-ng package and is avail-
able from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. January RENAME()

util-linux工具集中的rename的用法是 rename from to files 把文件名中的from改为to

Linux命令之rename的更多相关文章

  1. Linux命令之乐--rename

    用来修改文件名.重命名文件,批量重命名文件rename是最好的选择. 用法:rename from to files... [root@Director test]# ls a_01 a_02 [ro ...

  2. Linux下的rename命令

    Dos/Windows下,对文件改名用rename.而书上说,Linux下对文件或目录改名该用mv.我一直也是这样做的,却忽略了Linux下也有个叫rename的命令.都是rename,但功能上就有点 ...

  3. Linux下重命名文件或文件夹(mv命令与rename命令)

    在Linux下重命名文件或目录,可以使用mv命令或rename命令 mv ———————————— mv命令既可以重命名,又可以移动文件或文件夹. 例子:将目录A重命名为B mv A B 例子:将/a ...

  4. [Linux] Linux中重命名文件和文件夹的方法(mv命令和rename命令)

    原文链接 在Linux下重命名文件或目录,可以使用mv命令或rename命令,这里分享下二者的使用方法. mv命令既可以重命名,又可以移动文件或文件夹. 例子:将目录A重命名为B mv A B 例子: ...

  5. LINUX命令总结 -------来自 水滴娃娃 的CSDN

    LINUX命令总结 标签: LINUX命令总结 2014-01-27 15:54 41039人阅读 评论(1) 收藏 举报  分类: linux(1)  版权声明:本文为博主原创文章,未经博主允许不得 ...

  6. 运维工程师必会的109个Linux命令

    运维工程师必会的109个Linux命令 版本1.0 崔存新 更新于2009-12-26 目录 1 文件管理 6 1.1 basename 6 1.2 cat 6 1.3 cd 7 1.4 chgrp ...

  7. Linux命令(持续更新ing)

    *.命令语法:  a.在进行参数设定时,通常为“-”号,若为完整参数名称,则输入“--”符号;  b.指令太长的时候,可以使用“\”符号使指令连续到下一行;  c.各种符号的意义:    ''     ...

  8. linux 命令总结(转载)

    linux 命令总结(转载) 1. 永久更改ip ifconfig eth0 新ip 然后编辑/etc/sysconfig/network-scripts/ifcfg-eth0,修改ip 2.从Lin ...

  9. linux命令学习笔记

    操作文件和文件夹: copy: $ cp file1 file2 $ cp -r dir1 dir2 move: $ mv file .. $ mv file dir/ rename: $ mv fi ...

随机推荐

  1. 网络工程师岗位基础面试题【适用于CCNA/CCNP基础】

    网络工程师岗位基础面试题[适用于CCNA/CCNP基础] 1: 交换机是如何转发数据包的?交换机通过学习数据帧中的源MAC地址生成交换机的MAC地址表,交换机查看数据帧的目标MAC地址,根据MAC地址 ...

  2. RenderMonkey 练习 第三天 【OpenGL renderToTexture】

    渲染到纹理: 1. 新建一个OpenGL 空effect; 2. 添加渲染目标纹理, Add Texture-> Add Render Texture 3. 添加一个渲染pass 4. 将pas ...

  3. http://blog.sina.com.cn/s/blog_4a5dbd380101f031.html

    http://blog.sina.com.cn/s/blog_4a5dbd380101f031.html mvn clean install

  4. java 实现poi方式读取word文件内容

    1.下载poi的jar包 下载地址:https://www.apache.org/dyn/closer.lua/poi/release/bin/poi-bin-3.17-20170915.tar.gz ...

  5. 关于onclick的执行原理

    js 或者 jQuery 为文档某一节点添加onclick事件的时候,添加的onclick事件会添加在原节点的onclick事件之后,不会覆盖之前的onclick事件  如果不想让原onclick事件 ...

  6. Struts基本概念

    内容源自: Struts2基本概念 一.struts2体系结构: 1.Web浏览器请求一个资源.2.过滤器Dispatcher查找方法,确定适当的Action.3.拦截器自动对请求应用通用功能,如验证 ...

  7. [Functional Programming ADT] Create a Redux Store for Use with a State ADT Based Reducer

    With a well defined demarcation point between Redux and our State ADT based model, hooking up to a R ...

  8. js文件加载执行顺序

    转自:http://blog.163.com/water_down/blog/static/170276590201111711243458/ <script type="text/j ...

  9. PHPMailer_v5.1 使用[转]

    <?php /* * email 报警,主要检查服务器数据库是否还能正常连接 */ require("../common/config.php"); include(&quo ...

  10. Python中的__name__

    python中if __name__ == '__main__': 的解析 经常会在代码的最下面看到if __name__ == '__main__':,现在就来介 绍一下它的作用. 模块是对象,并且 ...