http://developers.sun.com.cn/blog/mde/entry/200602147
去掉^M
用户在ftp一个文本文件到系统后,vi 该文件的时候经常出现,文件的每行的末尾都会出现一个特殊字符^M,这是因为系统无法将微软的某些转义符无法翻译造成的,以下提供几个方法能很方便得去掉^M。
tr -d ‘^M’ <inputfile >outputfile tr命令能将inputfile文件里面的^M去掉,outputfile为输出的文件名,需要注意的是,inputfile,outputfile不能 使同一文件,否则会将inputfile的文件清空,另外像dos2unix也能将其去掉!
Post a Comment