免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: sandermansxj
打印 上一主题 下一主题

[文本处理] 请教该如何实现这个需求呢?---已解决 [复制链接]

论坛徽章:
39
辰龙
日期:2013-08-21 15:45:192015亚冠之广州富力
日期:2015-05-12 16:34:52亥猪
日期:2015-03-03 17:22:00申猴
日期:2015-03-03 17:21:37未羊
日期:2014-10-10 13:45:41戌狗
日期:2014-06-17 09:53:29巨蟹座
日期:2014-06-12 23:17:17双鱼座
日期:2014-06-10 12:42:44寅虎
日期:2014-06-09 12:52:172015亚冠之卡尔希纳萨夫
日期:2015-05-24 15:24:35黄金圣斗士
日期:2015-12-02 17:25:0815-16赛季CBA联赛之吉林
日期:2017-06-24 16:43:52
11 [报告]
发表于 2014-06-25 10:40 |只看该作者
本帖最后由 关阴月飞 于 2014-06-25 10:47 编辑

回复 10# sandermansxj


cmd下执行sed??   
请将单引号转为双引号即可:
  1. sed  "/<windows_root_path/s#>[^<]*#>.\\#"  urfile
复制代码

论坛徽章:
0
12 [报告]
发表于 2014-06-25 10:46 |只看该作者
C:\Program Files (x86)\Git\bin 里有sed.exe

这个和我本地环境有关系,我自己再查一查吧,谢谢楼上的各位帮忙了

论坛徽章:
39
辰龙
日期:2013-08-21 15:45:192015亚冠之广州富力
日期:2015-05-12 16:34:52亥猪
日期:2015-03-03 17:22:00申猴
日期:2015-03-03 17:21:37未羊
日期:2014-10-10 13:45:41戌狗
日期:2014-06-17 09:53:29巨蟹座
日期:2014-06-12 23:17:17双鱼座
日期:2014-06-10 12:42:44寅虎
日期:2014-06-09 12:52:172015亚冠之卡尔希纳萨夫
日期:2015-05-24 15:24:35黄金圣斗士
日期:2015-12-02 17:25:0815-16赛季CBA联赛之吉林
日期:2017-06-24 16:43:52
13 [报告]
发表于 2014-06-25 10:47 |只看该作者
回复 12# sandermansxj


    请参考11楼的做法

论坛徽章:
0
14 [报告]
发表于 2014-06-25 10:57 |只看该作者
回复 13# 关阴月飞


    还是不行哦


C:\NDS\contents-test>sed  "/<windows_root_path/s#>[^<]*#>.\\#"  contents.xml
sed: -e expression #1, char 33: unterminated `s' command

论坛徽章:
39
辰龙
日期:2013-08-21 15:45:192015亚冠之广州富力
日期:2015-05-12 16:34:52亥猪
日期:2015-03-03 17:22:00申猴
日期:2015-03-03 17:21:37未羊
日期:2014-10-10 13:45:41戌狗
日期:2014-06-17 09:53:29巨蟹座
日期:2014-06-12 23:17:17双鱼座
日期:2014-06-10 12:42:44寅虎
日期:2014-06-09 12:52:172015亚冠之卡尔希纳萨夫
日期:2015-05-24 15:24:35黄金圣斗士
日期:2015-12-02 17:25:0815-16赛季CBA联赛之吉林
日期:2017-06-24 16:43:52
15 [报告]
发表于 2014-06-25 11:11 |只看该作者
本帖最后由 关阴月飞 于 2014-06-25 11:12 编辑

回复 14# sandermansxj

可能是sed版本问题了.....
  1. c:\pf >sed  "/<windows_root_path/s#>[^<]*#>.\\#" test.txt
  2. <windows_root_path cmm_root_path_var="APPS_BUILD_ROOT">.\</windows_root_path>

  3.       <windows_root_path cmm_root_path_var="MPSS_BUILD_ROOT">.\</windows_root_path>

  4.       <windows_root_path cmm_root_path_var="BOOT_BUILD_ROOT">.\</windows_root_path>

  5.       <windows_root_path cmm_root_path_var="TZ_BUILD_ROOT">.\</windows_root_path>

  6.       <windows_root_path cmm_root_path_var="RPM_BUILD_ROOT">.\</windows_root_path>

  7.       <windows_root_path cmm_root_path_var="WCNSS_BUILD_ROOT">.\</windows_root_path>
  8. c:\pf >sed --version
  9. GNU sed version 4.2.1
  10. Copyright (C) 2009 Free Software Foundation, Inc.
  11. This is free software; see the source for copying conditions.  There is NO
  12. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
  13. to the extent permitted by law.

  14. GNU sed home page: <http://www.gnu.org/software/sed/>.
  15. General help using GNU software: <http://www.gnu.org/gethelp/>.
  16. E-mail bug reports to: <bug-gnu-utils@gnu.org>.
  17. Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.
复制代码

论坛徽章:
0
16 [报告]
发表于 2014-06-25 11:20 |只看该作者
回复 15# 关阴月飞


嗯,我自己再想想别的办法吧,谢谢啦
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP