如何在Linux / Unix中将多个文件从一个扩展名重命名为另一个扩展名?
发布时间:2021-02-20 22:45:05 所属栏目:Linux 来源:互联网
导读:我有一些以’.1’结尾的文件,例如: example.file.ex1.1example.file.ex2.1example.file.ex3.1 有没有办法可以快速重命名它们而不使用末尾的’.1′(例如example.file.ex1,example.file.ex2等)? 谢谢! 纯粹的bash解决方案: for curFile in example.file.*.1
我有一些以’.1’结尾的文件,例如: example.file.ex1.1 example.file.ex2.1 example.file.ex3.1 有没有办法可以快速重命名它们而不使用末尾的’.1′(例如example.file.ex1,example.file.ex2等)? 谢谢! 解决方法纯粹的bash解决方案:for curFile in example.file.*.1; do mv -- "$curFile" "${curFile:0:-2}" done (编辑:4S站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |