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 ...
随机推荐
- 解决:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile
在项目构建的时候遇到了这样的问题:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile(d ...
- animateBackground-plugin
(function ($) { if (!document.defaultView || !document.defaultView.getComputedStyle) { var oldCurCSS ...
- Node.js monly图片批量下载爬虫1.00
此爬虫又用到了iconv转码,代码如下: //====================================================== // mmonly图片批量下载爬虫1.00 ...
- Python代码可视化
把以下代码贴到这个网站: http://www.pythontutor.com l1 = [3, [66, 55, 44], (7, 8, 9)] l2 = list(l1) l1.append(10 ...
- Wpf修改控制的大小
Wpf修改控制的大小 随窗体的改变而改变 在WINFORM中设置控件的Anchor属性就行了 在WPF中没有Anchor属性 但可以在布局中设置 相关属性实现同样的效果 相关属性 Horizontal ...
- Unity3D研究院之DontDestroyOnLoad的坑
http://www.xuanyusong.com/archives/2938 Unity中的一个方法DontDestroyOnLoad可以让某些游戏对象在切换场景的时候不是施放,听起来是一个非常好的 ...
- Mysql 如何查询两个时间段之间的数据?
Mysql 如何查询两个时间段之间的数据?
- Linux LVM硬盘管理及LVM扩容【转】
原文地址:http://www.cnblogs.com/gaojun/archive/2012/08/22/2650229.html 一.LVM简介 LVM是 Logical Volume Manag ...
- IOS后台文件上传
public ModelAndView GetImage(HttpServletRequest request, HttpServletResponse response) throws Exce ...
- python生成.exe
python生成.exe 1.在Anaconda Prompt终端输入pip install pyinstaller 2.输入python -m pip install pypiwin32 pytho ...