iconv 批量修改文件编码

iconv_shell.sh

#!/bin/bash

if ["$#" != "2"];then
    echo "Usage: `basename $0` dir filter"
    exit
fi 

dir=$1
filter=$2
echo $1
for file in `find $dir -name "$2"`;do
    echo "$file"
    iconv -f gb18030 -t utf8 -o $file $file
done

 

use:

./iconv_shell.sh file_path *.html

 

posted on 2016-02-01 16:12  星空守望者--jkmiao  阅读(649)  评论(0编辑  收藏  举报