spluto 发表于 2013-02-15 11:20

请教ee编辑器里的^M问题

大家好,在FreeBSD下,想对一个php文件进行编辑,使用ee编辑器,结果出现了很多奇怪的符号,如下:

<?php^M
^M
/* geoipcity.inc^M
*^M
* Copyright (C) 2004 Maxmind LLC^M
*^M
* This library is free software; you can redistribute it and/or^M
* modify it under the terms of the GNU Lesser General Public^M
* License as published by the Free Software Foundation; either^M
* version 2.1 of the License, or (at your option) any later version.^M
*^M
* This library is distributed in the hope that it will be useful,^M
* but WITHOUT ANY WARRANTY; without even the implied warranty of^M
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU^M
* Lesser General Public License for more details.^M
*^M
* You should have received a copy of the GNU Lesser General Public^M
* License along with this library; if not, write to the Free Software^M
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA^M
*/^M
^M
/*^M
* Changelog:^M
* 2009-09-16 mike challis PHP 5.3 fix^M
* 2005-01-13   Andrew Hill, Awarez Ltd. (http://www.awarez.net)^M
*            Formatted file according to PEAR library standards.^M
*            Changed inclusion of geoip.inc file to require_once, so that^M
*                  this library can be used in the same script as geoip.inc.^M
*/^M
^M

可以看到,这里边有很多的^M这种东西,我可以确定的是,这东西不是代码里的,因为当我使用cat命令查看时,这些东西就消失了:

<?php

/* geoipcity.inc
*
* Copyright (C) 2004 Maxmind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA
*/

/*
* Changelog:
* 2009-09-16 mike challis PHP 5.3 fix
* 2005-01-13   Andrew Hill, Awarez Ltd. (http://www.awarez.net)
*            Formatted file according to PEAR library standards.
*            Changed inclusion of geoip.inc file to require_once, so that
*                  this library can be used in the same script as geoip.inc.
*/


有哪位大神可帮忙解释一下吗?谢谢啦!

ulovko 发表于 2013-02-15 11:38

cat -A 再看看
^M windows换行

spluto 发表于 2013-02-15 11:57

ulovko 发表于 2013-02-15 11:38 static/image/common/back.gif
cat -A 再看看
^M windows换行

版主,谢谢回复,FreeBSD下的cat貌似没有-A参数哦,还有什么其他的办法吗?

congli 发表于 2013-02-15 12:18

tr -d \\r < dosfile > newfile

congli 发表于 2013-02-15 12:19

或者到ports安装dos2unix工具

spluto 发表于 2013-02-15 12:34

congli 发表于 2013-02-15 12:19 static/image/common/back.gif
或者到ports安装dos2unix工具

貌似木有找到dos2unix的ports,55555 :'(

macafee 发表于 2013-02-15 14:23

cd /usr/ports/converters/unix2dos/ && make install clean

ulovko 发表于 2013-02-15 18:27

本帖最后由 ulovko 于 2013-02-15 18:29 编辑

@spluto 嗯 -A 是linux下面用的 你在bsd 里做如下操作:

#man cat   里面有这个功能 具体选项自己找
节选自:http://bbs.chinaunix.net/thread-3751834-1-1.html# cd /usr/ports/converters/unix2dos && make install clean   (unix2dos and dos2unix)

unix2dos and dos2unix are utilities that convert
ASCII files from the DOS cr/lf format to the UNIX
lf format..

spluto 发表于 2013-02-15 19:37

ulovko 发表于 2013-02-15 18:27 static/image/common/back.gif
@spluto 嗯 -A 是linux下面用的 你在bsd 里做如下操作:节选自:http://bbs.chinaunix.net/thread-375183 ...

谢谢版主,问题解决啦:-) :kiss:

spluto 发表于 2013-02-15 19:41

回复 7# macafee


谢谢,问题解决啦 :lol
页: [1] 2
查看完整版本: 请教ee编辑器里的^M问题