linux 中xargs命令实现批量重命名

 

001、

复制代码
[root@pc1 test]# ls
[root@pc1 test]# touch test{1..5}
[root@pc1 test]# ls
test1  test2  test3  test4  test5
[root@pc1 test]# ls test* | xargs mv {} {}.txt
mv: target ‘test5’ is not a directory
[root@pc1 test]# ls
test1  test2  test3  test4  test5
[root@pc1 test]# ls test* | xargs -i mv {} {}.txt     ## 需要添加-i参数
[root@pc1 test]# ls
test1.txt  test2.txt  test3.txt  test4.txt  test5.txt
复制代码

 

posted @   小鲨鱼2018  阅读(375)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
历史上的今天:
2022-01-05 linux中grep命令匹配制表符
2022-01-05 linux中如何删除空行
2022-01-05 linux中如何删除行首和行尾的空格或者制表符
2022-01-05 linux中如何删除^M符号
2022-01-05 linux中tr命令
2021-01-05 c语言中逆向显示数值
2021-01-05 c语言中后置递增运算和前置递增运算的差异
点击右上角即可分享
微信分享提示