euc-kr 을 utf-8 파일로 일괄 변환하는 쉘 스크립트
이 파일을 e2u.sh 라는 파일로 만든 후 퍼미션에 실행권한을 준다.
#!/bin/bash
iconv -c -f euc-kr -t utf-8 $1 > $1.tmp && mv $1.tmp $1
$> for i in `find . \( -name '*.php' -o -name '*.htm' -o -name '*.html' -o -name '*.css' -o -name '*.js' -o -name '*.sql' -o -name '*.txt' \) -print` ; do ./e2u.sh $i ; done
쉘에서 이 명령을 실행하면 하위 폴더까지 전부 charset 을 변환한다.
[이 게시물은 관리자님에 의해 2011-10-31 17:32:05 Linux에서 이동 됨]
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기
댓글 7개
http://kc99.tistory.com/674
find . -type f -name "*.php" -or -name "*.html" -or -name "*.htm" -or -name "*.css" -or -name "*.js" -or -name "*.txt" | while read srcfile; do
cp ${srcfile} ${srcfile}.bak
iconv -c -f euc-kr -t utf-8 ${srcfile}.bak > ${srcfile}
rm ${srcfile}.bak
done