본문 바로가기
정보기술/일반

텍스트 파일 한글 인코딩 변환 (euc-kr 에서 utf-8 로 변환) for Mac or UNIX

by fermi 2011. 8. 24.
http://kldp.org/node/63419
http://pc-to-mac-changer.blogspot.com/2010/02/shell-script-text-unicode.html

Shell script 이용

한개의 파일에 대해서 변환

#/bin/bash
iconv -c -f euc-kr -t utf-8 $1 > $1.tmp
mv $1.tmp $1

폴더 내의 smi, srt, txt 파일에 대해서 모두 변환

find "$1" -name "*.smi" -o -name "*.srt" -o -name "*.txt" | while read filename
do
tempName=${filename}~temp~.txt
mv "$filename" "$tempName"
iconv -c -f euc-kr -t utf-8 "$tempName" > "$filename"
rm "$tempName"
done




'정보기술 > 일반' 카테고리의 다른 글

유용한 달력 ics (ICAL) 모음  (0) 2011.12.06
Bookmarklets  (0) 2011.08.26
YouTube DNS Mapping Table  (0) 2011.08.23
Apple TV 2 와 XBMC 설정  (0) 2011.08.21
802.11n 2.4GHz 무선랜 Packet Loss 문제 해결  (0) 2011.07.20