Cause: Press enter to indicate:In dos, press enter (Cr, ASCII 13, r) to wrap (LF, ASCII 10, n. There is only one in Linux.
In Linux, you can use VI to view some text files created in windows. Sometimes you will find some "^ m" at the end of the line ". There are several methods for processing.
1. Use the dos2unix command. This tool is included in the general distribution version (if not, you can download it based on the following connection), which is very convenient to use:
$ Dos2unix myfile.txt
The above command removes the ^ m at the end of the line.
2. Use the replacement function of VI. Start VI and enter command mode. Enter the following command:
: % S/^ m $ // G # Remove the ^ m at the end of the row.
: % S/^ m // G # Remove all ^ m.
: % S/^ m/[Ctrl-v] + [enter]/G # Replace ^ m with the carriage return.
: % S/^ m/R/G # Replace ^ m with the carriage return.
3. Use the SED command. Similar to VI:
$ Sed-E's/^ m/n/G' myfile.txt
Note: Here '^ m' is generated using the CTRL-V CTRL-M instead of directly typing '^ m ".