免费注册 查看新帖 |

Chinaunix

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

求助,在文件的每一行结尾加上一个竖线。 [复制链接]

论坛徽章:
0
1 [报告]
发表于 2006-04-27 09:45 |显示全部楼层
原帖由 waker 于 2006-4-27 08:19 发表
请问各位的/g是什么思路?一行会有多个行尾么?
所以想请各位复习一下基础教程


做了一个测试
  1. myhost # more exam
  2. first line SWITCH here
  3. second line SWITCH here
  4. third line SWITCH here
  5. I have double SWITCHs this line. SWITCH
  6. the end
  7. myhost # sed 's/SWITCH/switch/' exam
  8. first line switch here
  9. second line switch here
  10. third line switch here
  11. I have double switchs this line. SWITCH
  12. the end
  13. myhost # sed 's/SWITCH/switch/g' exam
  14. first line switch here
  15. second line switch here
  16. third line switch here
  17. I have double switchs this line. switch
  18. the end
  19. myhost #
复制代码


可见g表示行上的全局而非整个文本的全局.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP