免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 3768 | 回复: 10
打印 上一主题 下一主题

[FreeBSD] 请教ee编辑器里的^M问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-02-15 11:20 |只看该作者 |倒序浏览
大家好,在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-1307  USA^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-1307  USA
*/

/*
* 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.
*/


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

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
2 [报告]
发表于 2013-02-15 11:38 |只看该作者
cat -A 再看看
^M windows换行

论坛徽章:
0
3 [报告]
发表于 2013-02-15 11:57 |只看该作者
ulovko 发表于 2013-02-15 11:38
cat -A 再看看
^M windows换行


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

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
4 [报告]
发表于 2013-02-15 12:18 |只看该作者
tr -d \\r < dosfile > newfile

评分

参与人数 1可用积分 +4 收起 理由
ulovko + 4 很给力!

查看全部评分

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
5 [报告]
发表于 2013-02-15 12:19 |只看该作者
或者到ports安装dos2unix工具

论坛徽章:
0
6 [报告]
发表于 2013-02-15 12:34 |只看该作者
congli 发表于 2013-02-15 12:19
或者到ports安装dos2unix工具


貌似木有找到dos2unix的ports,55555

论坛徽章:
0
7 [报告]
发表于 2013-02-15 14:23 |只看该作者
cd /usr/ports/converters/unix2dos/ && make install clean

评分

参与人数 1可用积分 +6 收起 理由
ulovko + 6 欢迎解答 ^_^

查看全部评分

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
8 [报告]
发表于 2013-02-15 18:27 |只看该作者
本帖最后由 ulovko 于 2013-02-15 18:29 编辑

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


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

  2. unix2dos and dos2unix are utilities that convert
  3. ASCII files from the DOS cr/lf format to the UNIX
  4. lf format..
复制代码

论坛徽章:
0
9 [报告]
发表于 2013-02-15 19:37 |只看该作者
ulovko 发表于 2013-02-15 18:27
@spluto 嗯 -A 是linux下面用的 你在bsd 里做如下操作:节选自:  http://bbs.chinaunix.net/thread-375183 ...


谢谢版主,问题解决啦

论坛徽章:
0
10 [报告]
发表于 2013-02-15 19:41 |只看该作者
回复 7# macafee


谢谢,问题解决啦
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP