分类: LINUX
2009-10-19 09:49:39
CR:Carriage Return(回车)
LF:Line Feed(换行)
windows use CR/LF to terminate line,*nix use LF,MAC uses CR.
if you tranfer windows file to unix.sometimes, you can see ^M at the end of each line in the file. ^M is CR sign in unix.
you can use tr or sed command to solve this problem.
windows -> Unix
tr -d '\r' < oldfile > newfile
sed 's/.$//'
Unix->windows
sed -e 's/$/\r/' myunix.txt > mydos.txt
in VIM
:set ff:show the file format.
:set ff=unix:set the file format to unix.