How to analyze the problem of DOS newline character
This article will explain in detail how to analyze the problem of DOS newline characters. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
A file copied to the Linux system on windows today did not notice the problem of newline characters, which caused a batch problem all the time.
A document copied especially through notepad.
First of all, check the cat-v file.txt to enter the following newline characters
UrrtIU56567= KoiH8IO188 ^ M
KymMPuAGuwBlqSWsWvK0 ^ M
^ M is the newline symbol with
$dos2unix-k killws remove the newline character
$cat-v file.txt
UrrtIU56567=koiiH8IO188
KymMPuAGuwBlqSWsWvK0
Or sed-I's / ^ M / / g 'file.txt
Or directly vim file.txt input set ff=unix. Save and exit!
Last
Dos2unix [- kn] file [newfile] converts from DOS to UNIX
Unix2dos [- kn] file [newfile] converts from UNIX to DOS, that is, WINDOWS
This is the end of the problem analysis on how to carry out DOS newline characters. I hope the above content can be of some help to you and can learn more knowledge. If you think the article is good, you can share it for more people to see.