In general, files edited under Windows under Linux with VI Open the end of the line will be more than a ^m symbol, such as:
This is because the text line breaks used by operating systems such as windows are different from the Unix/linux operating system, and the line breaks entered under windows are not displayed as "newline" under Unix/linux, but instead appear as ^m This symbol (which is a special tag specified under Linux and other systems, takes up a character size, not a combination of ^ and M, and cannot be printed). The following methods can be used to process: 1. Use the vi replacement function. Launch VI, enter command mode, enter the following command::%s/^m$//g # Remove the ^m at the end of the line. :%s/^m//g # Remove all the ^m. :%s/^m/[ctrl-v]+[enter]/g # Replace ^m with a carriage return. :%s/^m//r/g # Replace ^m with a carriage return.
Note: "^m" Here is generated using "Ctrl-v ctrl-m" instead of typing "^m" directly.
2. In the case of an XML file, you can use Xmllint to format the XML file and remove the ^m:
Xmllint--format Test.xml
Files edited under Windows under Linux with VI Open Line end will be more than a ^m symbol