Linux命令之rename
一、引言
今天才知道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的更多相关文章
- Linux命令之乐--rename
用来修改文件名.重命名文件,批量重命名文件rename是最好的选择. 用法:rename from to files... [root@Director test]# ls a_01 a_02 [ro ...
- Linux下的rename命令
Dos/Windows下,对文件改名用rename.而书上说,Linux下对文件或目录改名该用mv.我一直也是这样做的,却忽略了Linux下也有个叫rename的命令.都是rename,但功能上就有点 ...
- Linux下重命名文件或文件夹(mv命令与rename命令)
在Linux下重命名文件或目录,可以使用mv命令或rename命令 mv ———————————— mv命令既可以重命名,又可以移动文件或文件夹. 例子:将目录A重命名为B mv A B 例子:将/a ...
- [Linux] Linux中重命名文件和文件夹的方法(mv命令和rename命令)
原文链接 在Linux下重命名文件或目录,可以使用mv命令或rename命令,这里分享下二者的使用方法. mv命令既可以重命名,又可以移动文件或文件夹. 例子:将目录A重命名为B mv A B 例子: ...
- LINUX命令总结 -------来自 水滴娃娃 的CSDN
LINUX命令总结 标签: LINUX命令总结 2014-01-27 15:54 41039人阅读 评论(1) 收藏 举报 分类: linux(1) 版权声明:本文为博主原创文章,未经博主允许不得 ...
- 运维工程师必会的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 ...
- Linux命令(持续更新ing)
*.命令语法: a.在进行参数设定时,通常为“-”号,若为完整参数名称,则输入“--”符号; b.指令太长的时候,可以使用“\”符号使指令连续到下一行; c.各种符号的意义: '' ...
- linux 命令总结(转载)
linux 命令总结(转载) 1. 永久更改ip ifconfig eth0 新ip 然后编辑/etc/sysconfig/network-scripts/ifcfg-eth0,修改ip 2.从Lin ...
- linux命令学习笔记
操作文件和文件夹: copy: $ cp file1 file2 $ cp -r dir1 dir2 move: $ mv file .. $ mv file dir/ rename: $ mv fi ...
随机推荐
- ylbtech-LanguageSamples-Hello World
ylbtech-Microsoft-CSharpSamples:ylbtech-LanguageSamples-Hello World 1.A,示例(Sample) 返回顶部 “Hello World ...
- 怎样在Ubuntu手机应用中得到全部的环境变量值
我们在先前的例程中已经通过一些方法得到我们应用的一些环境变量值.这些值有的很实用.比方我们能够得到我们应用所仅仅能訪问的文件夹.在今天的例程中,我们来展示一种方法能够得到应用全部的环境变量.在我们的实 ...
- Apache2.4 与 php7.1.6的链接
首先Apache已经安装成功,在浏览器中能够打开再下载php 我的Apache安装版本为Apache2.4.26 x64 vc14 所以我php也应该是vc14编译的 php下载地址为 http:// ...
- strcpy,memcpy,memmove和内存重叠分析
一:strcpy函数用法和实现: /* GNU-C中的实现(节选): */ char* strcpy(char *d, const char *s) { char *r=d; while((*d++= ...
- 倍福TwinCAT(贝福Beckhoff)常见问题(FAQ)-如何修改代码字体
工具-选项 TwinCAT,PLC Environment,Text editor,然后在文本区域中修改字体 更多教学视频和资料下载,欢迎关注以下信息: 我的优酷空间: http://i. ...
- 使用jsmin压缩javascript脚本
官方地址:http://www.crockford.com/javascript/jsmin.html 点击页下方的”zip file containing an MS-DOS.exe file“下载 ...
- Firefly 性能测试 通报
http://bbs.gameres.com/forum.php?mod=viewthread&tid=220516 Firefly 性能测试 主要考虑点 网络IO的并发 进程间通信压力 数据 ...
- 2015 ICPC 沈阳站M题
M - Meeting Time Limit:6000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit ...
- OpenERP(odoo)开发实例之搜索检索过去3个月的数据
转自:http://www.chinamaker.net/ OpenERP(odoo)开发实例之搜索过滤:检索过去3个月的数据 解决这个问题的重点在于 relativedelta 的应用 示例代码如下 ...
- linux修改密码出现Authentication token manipulation error的解决办法
转自 :http://blog.163.com/junwu_lb/blog/static/1916798920120103647199/ Authentication token manipulati ...