How to convert the internal code of a text file in Linux
Source: Internet
Author: User
Article Title: how to convert the internal code of a text file in Linux. Linux is a technology channel of the IT lab in China. Some basic categories such as desktop applications, Linux system management, kernel research, embedded systems and open-source software are available in Windows to convert file encoding, such as converting BIG5 encoding into 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 both GB2312 internal code
Make a special trip to BIG5, and add BIG5 as the suffix.
Create a script gb2312_2_big5.sh with the following content:
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