Linux-although I am not an O & M engineer for simulating dos2unix commands, I have encountered some interesting problems due to studying linux and shell scripts, for example, we often Upload text files in the window environment to linux. because of the different terminologies of the two, sometimes the configuration problem occurs because... linux-although I am not an O & M engineer for simulating dos2unix commands, I have encountered some interesting problems due to studying linux and shell scripts, for example, we often Upload text files in the window environment to linux. due to the different terminologies of the two, sometimes the configuration problem occurs because linux does not know the Terminator of the original window environment, in this way, we can re-add the Terminator under the original Terminator. we can use cat-v-E test.txt to view the data.-v indicates that the hidden character-E indicates that the Terminator is displayed, the data is as follows: www.2cto.com 395439881 ^ M $ ^ M is the ending character of the window file. in linux, $ is the ending character 395 of the linux file. 423434 ^ M $395468635 ^ M $395436444 ^ M $395463623 ^ M $ Let's replace the Terminator in the window. Otherwise, it cannot be processed properly, we can use the following methods to process www.2cto.com cat test.txt | tr-d '\ r' | cat-v. we can use cat-v to check whether 395439881395423434395468635395436444395463623 is successfully replaced. if the hidden character is not \ r how to do cat-v test.txt | sed's: \ (\ ^ \ w \ + \):: '| cat-v 395439881395423434395468635395436444395463623 note that cat-v may display hidden characters in special ways. Therefore, you can directly replace them when passing through pipelines, here, after cat-v, \ r cannot represent the window Terminator, which is converted ...... Mcat test.txt | sed's: \ r: '| cat-v is the easiest way to use the dos2unix command.
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