Open the edited text of Windows under Linux, and there will be an issue with content formatting that is inconsistent with line breaks. The most common is the appearance of ^m.
my problem is: in Windows edited files, uploaded to Linux and then opened with Vim, the content is not wrapped. That is, all the file contents are on one line. And then the actual line of the position more than a ^m.
The following method is searched online. One of the Dos2unix also has a relative Unix2dos
1. Use the Dos2unix command. This gadget is available in the general distribution version (if it is not available to download according to the following connection), it is convenient to use: $ dos2unix myfile.txt The above command will remove the ^m at the end of the line.
2. Use the Replace function of VI. 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. (I tuned it in this way):%s/^m/\r/g # Replace ^m with a carriage return.
3. use the SED command. Similar to the use of VI: $ Sed-e ' s/^m/\n/g ' myfile.txt Note: Here the "^m" is generated using "Ctrl-v ctrl-m" instead of typing "^m" directly.