Convert the internal code of a text file in Linux-Linux general technology-Linux programming and kernel information. For details, see the following. There are a lot of software in windows that can be used to convert the file encoding, such as converting BIG5 to GB2312
This can also be done in linux.
This command is iconv.
For example, to convert the foo.txt file in gb2312format to the BIG5 internal code, you can use
Iconv-f GB2312-t BIG5 foo.txt> foo1.txt
This new file foo1.txt is the BIG5 internal code.
Convert the big5's foo.txt file to the GB2312 internal code
Iconv-f BIG5-t GB2312 foo.txt> foo2.txt
Convert the GB2312 internal code file into a UTF-8
Iconv-f GB2312-t UTF-8 foo.txt> foo3.txt
Finally, batch conversion is used to convert all the files in a directory into the internal code we need.
Foo1.txt foo2.txt foo3.txt... foon.txt is the internal code of GB2312.
Make a special trip to BIG5, and add BIG5 as the suffix.
Create a script gb2312_2_big5.sh with the following content:
Ls *. txt | while read I
Do iconv-f GB2312-t BIG5 $ I >$ I. big5
Done
Save and run
Sh gb2312_2_big5.sh
Conversion can be completed.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service