Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to analyze the problem of DOS newline character

Shulou Source: shulou.com Published: 2022-05-31 13:22:24 10月04日 Update

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.

Tags: Newline character question analysis content copy file article more knowledge article input yes that is system notepad quality reference help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Linux Shulou Technology MySQL Microsoft