In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
It is well known that there are great differences in character set coding and regular character locators between Windows and Unix. If you transfer files between different systems, it will always bring a lot of errors because of the differences in character set coding and character locators.
First of all, let's talk about character set coding. In unix, Utf-8 is generally used, but in Windows systems, most of them are GB2312 (simplified Chinese), BIG5 (traditional Chinese), and so on. If the character set is incorrect, there will be garbled codes when the source file is opened. At this time, we need to use iconv to convert the source file to adapt to different system environments. The usage of iconv is as follows:
Usage: iconv [option.] [file.] Converts the encoding of a given file. Input / output format specification:-f,-- from-code= name original text encoding-t,-- to-code= name output encoding information:-l,-- list enumerates all known character set output controls:-c ignores invalid characters from the output-o -- output=FILE output file-- s,-- silent shutdown warning-- verbose print progress information-help gives the system help list-- usage gives brief usage information-- V,-- version printer version number.
In this way, we can write a script through this instruction and use it in the actual production environment. Generally speaking, this software is installed by default when the system is installed. If you can not download the source package installation on gnu's website, this installation does not have any dependent packages, and the installation is very simple, so I will not repeat it here.
Wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
In addition to the character set coding, there are some differences in the regular locators used between Windows and Unix. For example, files edited by Windows have a meeting in the unix system, and there will be "^ M" at the end of each line, which is the problem of the difference in regular locators between the two. The line Terminator is "^ M $" in Windows and "$" in unix system, so we will have a lot of trouble when we use it, so we need to use unix2dos dos2unix2 instructions to convert regular locators. When using these two instructions, you can install them directly when the yum source is configured correctly, as follows:
[root@localhost ~] # yum-y install unix2dos dos2unixdos2unix and unix2dos:-k: keep the date of the output file unchanged-Q: quiet mode without warning. -V: view version-c: conversion pattern. Patterns are: ASCII, 7bit, ISO, Mac. Default is: ASCII. -o: write to source file-n: write to new file both use the same parameter options, except that dos2unix converts DOS (that is, Windows) to UNIX format, while unix2dos does the opposite
Usually we need to pay attention to these problems when exchanging files between different systems so as not to cause errors.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.