当前位置: 技术问答>linux和unix
求iconv批处理脚本
来源: 互联网 发布时间:2017-03-07
本文导语: 比如把文件夹下所有文件都从gbk转码成utf8储存,最好能递归把所有子目录下的文件也储存。 | #!/bin/bash #Program: # Convert encoding of given files from one encoding to another ...
比如把文件夹下所有文件都从gbk转码成utf8储存,最好能递归把所有子目录下的文件也储存。
|
#!/bin/bash
#Program:
# Convert encoding of given files from one encoding to another
#History:
#11/22/2009
#read -p "Please input a directory as absolute path: " dir
files=$(ls --format=single-column|grep -v 'iconv.sh')
for filename in $files
do
iconv -f big5 -t gb2312 ${filename} |
iconv -f gb2312 -t utf8 -o ${filename}
done
#Program:
# Convert encoding of given files from one encoding to another
#History:
#11/22/2009
#read -p "Please input a directory as absolute path: " dir
files=$(ls --format=single-column|grep -v 'iconv.sh')
for filename in $files
do
iconv -f big5 -t gb2312 ${filename} |
iconv -f gb2312 -t utf8 -o ${filename}
done