参考链接1:shell脚本:批量修改文件名(删除文件名中字符)
参考链接2:linux shell 字符串操作详解 (长度,读取,替换,截取,连接,对比,删除,位置 )
参考链接3:每天一个linux命令(21):find命令之xargs
参考链接4:SED 简明教程
参考链接5:shell 学习第十天—sed 查找与替换

#批量改名,增加字符
ls | xargs -t -i mv {} xxx_{}

#批量改名,删除/增加字符
#方式一:
for file in `ls xxx_*`;do mv $file `echo $file|sed 's/xxx_//g'`;done;
for file in `ls *.fq`;do mv $file `echo $file|sed 's/.fq/cleaned.fq/g'`;done;

#批量改名,删除字符
#方式二:
ls xxx_*|awk -F "xxx_" '{print "mv "$0" "$2""}'|bash

#批量改名,删除字符
#方式三:
rename "xxx_" "" xxx_*

#批量改名,删除字符
#方式四:
for file in `ls xxx_*`;do mv $file ${file#xxx_};done;

相关文章:

  • 2022-12-23
  • 2022-03-02
  • 2022-12-23
  • 2022-02-07
  • 2021-12-13
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2021-05-27
  • 2021-10-28
相关资源
相似解决方案