• rename批量修改文件名


    批量改名:

    如文件,批量修改,把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 内容 内容 文件

  • 相关阅读:
    jni 调用
    [2016-04-19 15:46:03
    java正则表达式
    proguaid 混淆代码
    nable to execute dex: Multiple dex files define Lcom/chinaCEB/cebActivity/R
    素质与修养
    纪律
    Android百度地图开发 百度地图得到当前位置
    定义一些常亮
    Android 有些机型hint不显示
  • 原文地址:https://www.cnblogs.com/chuangcc/p/11228712.html
Copyright © 2020-2023  润新知