免费注册 查看新帖 |

Chinaunix

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

[文本处理] 如何去掉只有一个#的行 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-09-17 16:44 |显示全部楼层 |倒序浏览
  1. # See also the proxy_interfaces parameter, for network addresses that
  2. # are forwarded to us via a proxy or network address translator.
  3. #
  4. # Note: you need to stop/start Postfix when this parameter changes.
  5. #
  6. #inet_interfaces = all
  7. #inet_interfaces = $myhostname
  8. #inet_interfaces = $myhostname, localhost
  9. inet_interfaces = localhost

  10. # Enable IPv4, and IPv6 if supported
  11. inet_protocols = all

  12. # The proxy_interfaces parameter specifies the network interface
复制代码
请问,如何去只有#的行,和以“# ”开头的行,处理后的结果是这样的:
#inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
inet_interfaces = localhost

inet_protocols = all

谢谢!

论坛徽章:
0
2 [报告]
发表于 2013-09-17 17:49 |显示全部楼层
回复 2# HH106

献丑了。。

那时候是因为好奇注册了下
   

论坛徽章:
0
3 [报告]
发表于 2013-09-18 08:52 |显示全部楼层
回复 3# Shell_HAT


    谢谢!^和$代表正行我没有想到。

论坛徽章:
0
4 [报告]
发表于 2013-09-18 08:59 |显示全部楼层
回复 4# jason680


    谢谢!
我man了下grep,看到-P是用的perl,效果是和-E扩展正则一样的吧。

论坛徽章:
0
5 [报告]
发表于 2013-09-18 09:03 |显示全部楼层
回复 6# henryele


    貌似不对
结果中没有不以#开头的行

论坛徽章:
0
6 [报告]
发表于 2013-09-24 16:01 |显示全部楼层
回复 15# baoersc


    应该是空格的意思
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP