【发布时间】:2016-02-12 03:16:56
【问题描述】:
我想在段落中搜索以 word1 开头并以 word2 结尾的模式,如果模式匹配,则打印段落的第一行,我不确定是否可以使用 grep 例如,如果我有以下文件并且我正在寻找 aaa
Word1 this is paragraph number 1
aaa
bbb
ccc
word2
Word1 this is paragraph number 2
bbb
ccc
ddd
word2
答案应该是这样的
Word1 this is paragraph number 1
【问题讨论】: