批量改名:

如文件,批量修改,把hello去掉
[root@localhost wang]# ll
-rw-r--r-- 1 root root 0 5月 14 02:36 a.hello.txt
-rw-r--r-- 1 root root 0 5月 14 02:36 b.hello.txt

方法一:
使用sed

for i in `ls *.txt`;do mv $i `echo $i|sed 's/hello.//g'`;done

[root@localhost wang]# ll
总用量 0
-rw-r--r-- 1 root root 0 5月 14 02:46 a.txt
-rw-r--r-- 1 root root 0 5月 14 02:46 b.txt

方法二:

使用awk
for i in `ls *.txt`;do mv $i `echo $i | awk -F '.hello' '{print $1 $2}'`;done

方法三:

专业改名工具:rename
语法
rename from to file
from:你要改的内容
to:改成什么内容
file:对什么文件修改
案例:
[root@localhost wang]# ll
-rw-r--r-- 1 root root 0 5月 14 02:36 a.hello.txt
-rw-r--r-- 1 root root 0 5月 14 02:36 b.hello.txt

[root@localhost wang]# rename .hello "" *.txt ##改为

[root@localhost wang]# ll
总用量 0
-rw-r--r-- 1 root root 0 5月 14 02:36 a.txt
-rw-r--r-- 1 root root 0 5月 14 02:36 b.txt

总结: rename 内容 内容 文件

rename批量修改文件名的更多相关文章

  1. rename 批量修改文件名简单用法

    有的时候我们需要批量创建文件做测试,为了做区分,一般只要稍稍动动文件名即可,MV命令既可以移动文件,也是可以修改文件名的,但批量修改文件名MV做不到,此时,我们可以用rename命令批量修改是蛮不错的 ...

  2. rename 批量修改文件名

    1.rename的用法 rename与mv的区别就是mv只能对单个文件重命名,而rename可以批量修改文件名 linux中的rename有两种版本,一种是C语言版的,一种是Perl版的.早期的Lin ...

  3. Linux下批量修改文件名(rename)

    原文地址: http://blog.csdn.net/sea_shore/article/details/6102437 1.rename命令批量修改文件名, 其实linux下可以使用别的办法来批量修 ...

  4. 初学shell,为了练习sed,写了个简单的批量修改文件名的脚本,后来执行时发现系统竟然自带有一个rename命令,顺便也记下了

    1 #!/bin/bash   2 <<Comment   3 批量修改文件名的脚本   4 2015/10/24   5 webber   6 Comment   7 ARGS=2   ...

  5. Linux下find一次查找多个指定类型文件,指定文件或者排除某类文件,在 GREP 中匹配多个关键 批量修改文件名等

    http://blog.sina.com.cn/s/blog_62e7fe670101dg9d.html linux下二进制文件查找: strings 0000.ts | grep -o " ...

  6. linux批量修改文件名的shell脚本

    linux中批量修改文件名的shell脚本代码,主要是使用了rename,结合shell,喜欢的朋友可以参考下 使用 rename 命令  ========================  NAME ...

  7. 用python批量修改文件名

    从youtube上当下来百来首mv,每个都需要去掉视频,这还挺好弄得,格式工厂一弄就完了,但是文件名,都带有乱七八糟的*啥的巴拉巴拉的,咋修改啊,几百首总不可能一个一个rename吧 #批量修改文件名 ...

  8. 批量修改文件名后缀,例如:html修改成HTML

    批量修改文件名后缀,例html修改成HTML 把文件后缀名html全部修改成HTML: 例:aa.html aa.HTML #!/bin/bash for file in `ls`;do mv $fi ...

  9. shell脚本:批量修改文件名

    参考链接1:shell脚本:批量修改文件名(删除文件名中字符) 参考链接2:linux shell 字符串操作详解 (长度,读取,替换,截取,连接,对比,删除,位置 ) 参考链接3:每天一个linux ...

随机推荐

  1. Error: unable to perform an operation on node 'rabbit@DESKTOP-6JT7D2H'. Please see diagnostics information and suggestions below.

    https://blog.csdn.net/qq_32814555/article/details/79494533

  2. C++、java、python的一些区别

    1.变量类型 变量赋值命名不同 Python 中的变量赋值不需要类型声明 counter = 100 # 赋值整型变量 miles = 1000.0 # 浮点型 name = "John&q ...

  3. 019:re_path函数详解

    re_path使用: 1.re_path和path的作用是一样的,只不过re_path在写url的时候可以使用正则表达式——功能更加强大: 2.使用正则表达式时,推荐使用原生字符串(即:已 r 开头的 ...

  4. JS Null 空 判断

    JS判断对象是否为空 https://www.cnblogs.com/mountain-mist/articles/1600995.html http://www.cftea.com/c/2007/0 ...

  5. postman—创建collection,执行collection和批量执行

    接口测试中,可以在 Postman 逐个创建请求.但当请求逐渐增多时,如果我们不采取任何措施管理,散乱的请求维护起来就比较麻烦了.这个时候我们可以创建测试集 Collection 来对这些请求进行管理 ...

  6. linux 系统时间 硬件时间

    Linux时钟分为系统时钟(System Clock)和硬件时钟(Real Time Clock,简称RTC).系统时钟是指当前Linux Kernel中的时钟:而硬件时钟则是主板上由电池供电的时钟, ...

  7. TTTTTTTTTTTTTT CDOJ Sliding Window 线段树(nlogn)或双端队列(n) 模板

    题目链接: L - Sliding Window Time Limit:6000MS     Memory Limit:131072KB     64bit IO Format:%lld & ...

  8. _vimrc

    set nocompatible source $VIMRUNTIME/vimrc_example.vim source $VIMRUNTIME/mswin.vim behave mswin set ...

  9. sh_12_转义字符

    sh_12_转义字符 # \t 在控制台输出一个 制表符,协助在输出文本时 垂直方向 保持对齐 print("1\t2\t3") print("10\t20\t30&qu ...

  10. SWPUCTF2019 | Network

    这题真的就靠百度的,第一次接触TTL型的misc,直接拿了一个大佬的脚本,改了一丢丢: with open('t.txt') as f: lines = f.readlines() n_num = [ ...