Linux goes down ^ M

the first method:

cat -A filename, you can see the break character under windows ^ M

To remove him, simply use the following command:

dos2unix filename 

c02n03 node

The second method:

sed -i ‘s/^M//g' filename

#Note: The input method of ^ M is Ctrl + v, then Ctrl + M

The third method:

#vi filename

:1,$ s/^M//g

^ M Input method: ctrl + V, ctrl + M

The fourth method:

#cat filename |tr -d ‘/r' > newfile

# ^ M can be replaced with / r

Published 69 original articles · Like 72 · Visit 240,000+

Guess you like

Origin blog.csdn.net/londa/article/details/101421408
Recommended