[Bash] Convert Files in Directory From Big5 to UTF-8
source link: http://siongui.github.io/2016/03/18/bash-convert-files-in-directory-from-big5-to-utf8/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
[Bash] Convert Files in Directory From Big5 to UTF-8
March 18, 2016
Question:
A lot of HTML files under dhpstory directory. The encoding of the files is Big5. Converted them to UTF-8 encoding via iconv command.
Answer:
convert.sh | repository | view raw
#!/bin/sh # Convert all files in directory from Big5 to UTF-8 # list all files recursively for file in $(find dhpstory/ -type f) do output=${file}-utf8.html echo "\033[92mConverting ${file} (BIG5) to ${output} (UTF8) ...\033[0m" iconv -f BIG5 -t UTF8 ${file} > ${output} done
References:
[1][Bash] List All Files in Directory Recursively and Rename
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK