您的位置:首页 > 其它

文件批量创建和修改

2015-06-09 11:31 148 查看
批量创建文件

[root@localhost test]# touch test{01..10}
[root@localhost test]# ls
test01  test02  test03  test04  test05  test06  test07  test08  test09  test10
2.rename批量修改文件
[root@localhost test]# ls
hello02  hello03  hello04  hello05  hello06  hello07  hello08  hello09
[root@localhost test]# rename hello test hello*
[root@localhost test]# ls
test02  test03  test04  test05  test06  test07  test08  test09
[root@localhost test]# ls
test04.log  test05.log  test06.log  test07.log  test08.log  test09.log  test10.log
[root@localhost test]# rename .log .txt *.log
[root@localhost test]# ls
test04.txt  test05.txt  test06.txt  test07.txt  test08.txt  test09.txt  test10.txt
[root@localhost test]# ls
test04.txt  test05.txt  test06.txt  test07.txt  test08.txt  test09.txt  test10.txt
[root@localhost test]# rename .txt "" *.txt
[root@localhost test]# ls
test04  test05  test06  test07  test08  test09  test10
3.for循环修改文件名
[root@localhost test]# ls
test02  test03  test04  test05  test06  test07  test08  test09
[root@localhost test]# for i in *; do mv $i $i".log" ; done
[root@localhost test]# ls
test02.log  test03.log  test04.log  test05.log  test06.log  test07.log  test08.log  test09.log


本文出自 “滴不尽相思血泪抛红豆” 博客,请务必保留此出处http://beijgh.blog.51cto.com/8272564/1659988
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: