Linux脚本将目录下所有文件由GB2312转为UTF-8

find ./ -type f -name "*.asp"|while read line;do 
echo $line 
iconv -f GB2312 -t UTF-8 $line > ${line}.utf8 
mv $line ${line}.gb2312 
mv ${line}.utf8 $line 
done
find ./ -type f -name "*.gb2312" -exec rm -f {} \; 


另存为gbk2utf8.sh

执行一下,将把当前目录及子目录下所有.asp文件编码转换为utf-8

你可能感兴趣的:(linux)