2011-05-18 wcdj
Problem:
When you run the cat-V filename command in Linux to view files written in Windows, you can find that each line ends with a ^ m character. An unexpected error occurs when an application written in Linux reads a file containing ^ m characters. Therefore, you need to convert the file format in windows to the file format in Linux.
There are still doubts:
Open the file containing ^ m in my VI, and set: set list can only see the line break represented by "$", but not ^ m characters. Replacement with: %/^ m $/g is not found.
Note:
To get the ^ m do not actually enter it as is. insert it by typing the CTRL-V sequence instead.
Remove ^ m:
There are many ways to remove ^ m, which are summarized as follows:
Method 1:
To convert the file format in VI, run the following command: WQ.
: Set fileformat = Unix
: Set fileformat = DoS
Method 2:
Use the col command
Cat file_win | col-B> file_linux
Cat file_win | col-B | tee file_linux
Method 3:
Use the tr command
Cat file_win | tr-D'/R'> file_linux
Cat file_win | tr-D'/R' | tee file_linux
Refer:
Removing CRLF using vi
Http://phaq.phunsites.net/2006/07/25/removing-crlf-using-vi/
Why does my VI sometimes not display carriage return and line break characters in Windows ^ m
Http://bbs.chinaunix.net/viewthread.php? Tid = 757832
VI displays line breaks and other special symbols
Http://blog.163.com/mageng11@126/blog/static/14080837420110211753226/
Linux: Col Filter Control Character/seq Sequence Generation
Http://cicikasa.blog.163.com/blog/static/13757535520102495718203/