Transferred from: http://blog.csdn.net/lhf_tiger/article/details/8203013
It's disgusting, the 10X process generated by the CSV file row bit actually has ^m characters, harm I have been looking for the cause of the error, really pit, fortunately, I finally found out. have been using Python,perl is becoming more and more unskilled. Commissioning took a long time.
Replace ^m characters
Use VI under Linux to see some text files created under Windows, and sometimes find some "^m" at the end of the line. There are several ways to handle this.
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. Start VI, enter command mode, and 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.
3. Use the SED command. Similar to the use of VI:
$ Sed-e ' s/^m/\n/g ' myfile.txt
Note: "^m" Here is generated using "Ctrl-v ctrl-m" instead of typing "^m" directly.
Transferred from: http://hi.baidu.com/mofeis/blog/item/23c7b2fb92dc97234e4aea6d.html
In Vim's _VIMRC file, remove the Fileformat=unix.
Linux Replacement ^m Character method