shell批量修改文件名方法
1.
创建
[root@shnne ~]# cat mk.sh
#!/bin/sh
for((i=1; i<=10; i++))
do
j=`cat /dev/urandom|head -1|md5sum|cut -c 1-5`
touch shnne/${j}_shnne_$i.html
done
修改
[root@shnne ~]# cat mod.sh
#!/bin/sh
cd /root/shnne
for i in `ls *.html`
do
mv $i `echo $i|sed 's#\(.*\)shnne\(.*\).html#\1linux\2.HTML#g'`
done
2.
通过rename方式
rename shnne linux *.html << 上一篇
下一篇 >>
网友留言(0 条)