euc-kr 을 utf-8 파일로 일괄 변환하는 쉘 스크립트 > 개발자팁

개발자팁

개발과 관련된 유용한 정보를 공유하세요.
질문은 QA에서 해주시기 바랍니다.

euc-kr 을 utf-8 파일로 일괄 변환하는 쉘 스크립트 정보

기타 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에서 이동 됨]
추천
4
  • 복사

댓글 7개

euckr2utf8.sh 도 있네요.

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
© SIRSOFT
현재 페이지 제일 처음으로