【问题标题】:on Linux, how to change file name from blah_m_n_12192012.txt to blah_m_n.txt在 Linux 上,如何将文件名从 blah_m_n_12192012.txt 更改为 blah_m_n.txt
【发布时间】:2012-12-06 11:23:26
【问题描述】:

其中 m,n 可以是 0 到 100 之间的任意数字,例如

blah_5_9_12192012.txt -> blah_5_9.txt
blah_4_35_12192012.txt -> blah_4_35.txt

我尝试了以下操作,但没有成功

mv blah_?_*_12192012.txt blah_?_*.txt

【问题讨论】:

    标签: linux file-rename mv


    【解决方案1】:
    for file in blah_?_*_12192012.txt
    do
      mv $file ${file/_12192012/}
    done
    

    【讨论】:

      猜你喜欢
      • 2016-02-03
      • 2021-05-05
      • 1970-01-01
      • 2017-11-07
      • 2022-01-05
      • 2017-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多