开发者社区 问答 正文

sed命令筛选指定字符串之间的行

为什么我没效果呢? 后面那个so也被带出来了。怎么办? 难道sed找不出来吗?

[root@Jason64-18 oldboy]# cat net 
so you must be listen to me
I don't know what are you fucking about
what  ? shit !
now now now , stop
google is very nice
no i so 
[root@Jason64-18 oldboy]# sed -n '/so/,/shit/'p net 
so you must be listen to me
I don't know what are you fucking about
what  ? shit !
no i so 
[root@Jason64-18 oldboy]#

展开
收起
a123456678 2016-06-14 10:16:00 2665 分享 版权
1 条回答
写回答
取消 提交回答
  • cat net | sed -n '/so/,/shit/p' | sed -n '1!p' | sed -n '$!p' |  sed -n '$!p'
    2019-07-17 19:36:53
    赞同 展开评论
问答分类:
问答地址: