免费注册 查看新帖 |

Chinaunix

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

遇到<? 要如何作??? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-07-27 11:24 |只看该作者 |倒序浏览
我想改php file内的旧语法格式
sed -i '1s/^"\<\? "/"\<\?php"/'  file.php

下如此也改不掉
sed -i '1s/^\<? /\<\?php/'  file.php

遇到<?  要如何作???

论坛徽章:
0
2 [报告]
发表于 2010-07-27 11:26 |只看该作者
没有看懂,你还是把你那行写上来把,大家也好做

论坛徽章:
0
3 [报告]
发表于 2010-07-27 11:29 |只看该作者
就是php 文件的旧语法阿~~

像php 文件内部是开头都是
<?


结尾
?>

我是要改开头列 sed 1s

如: footer文件内容为
<?

/*
        CVS Revision. 1.1.0
*/

class FastTemplate {

        var $FILELIST   =       array();        //      Holds the array of filehandles
                                                                        //      FILELIST[HANDLE] == "fileName"

        var $DYNAMIC    =       array();        //      Holds the array of dynamic
                                                                        //      blocks, and the fileHandles they
                                                                        //      live in.

        var $PARSEVARS  =       array();        //      Holds the array of Variable
                                                                        //      handles.
                                                                        //      PARSEVARS[HANDLE] == "value"

        var     $LOADED         =       array();        //      We only want to load a template
                                                                        //      once - when it's used.
                                                                        //      LOADED[FILEHANDLE] == 1 if loaded
                                                                        //      undefined if not loaded yet.

        var     $HANDLE         =       array();        //      Holds the handle names assigned
                                                                        //      by a call to parse()

        var     $ROOT           =       "";                     //      Holds path-to-templates

        var $WIN32              =       false;          //      Set to true if this is a WIN32 server

        var $ERROR              =       "";                     //      Holds the last error message

        var $LAST               =       "";                     //      Holds the HANDLE to the last
                                                                        //      template parsed by parse()

        var $STRICT             =       true;           //      Strict template checking.
                                                                        //      Unresolved vars in templates will

.........略
?>

论坛徽章:
0
4 [报告]
发表于 2010-07-27 11:35 |只看该作者
没有用过php。。。
  1. sed 's/<?/<?php/' filename
复制代码

论坛徽章:
0
5 [报告]
发表于 2010-07-27 11:38 |只看该作者
  1. sed 's#<?#<?php#' file
复制代码
这么个意思?

论坛徽章:
0
6 [报告]
发表于 2010-07-27 11:38 |只看该作者
本帖最后由 Demon 于 2010-07-27 11:40 编辑

thx 好看的附件
可以了
但我只改1s
所以加sed -i '1s/^<?/<?php/'  file.php

奇怪<?不用转义??

论坛徽章:
0
7 [报告]
发表于 2010-07-27 11:42 |只看该作者
这么个意思?
lkk2003rty 发表于 2010-07-27 11:38



    #  其实就是 / 还可以是%

讨论区帖子上有教~~
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP