如何使用sed获取两行之间的内容,但两条匹配的行被转义

Rui*_*Rui 2 bash sed

我目前正在玩sed来获取两行之间的内容.我有一个很好的教程:http://www.cyberciti.biz/faq/unix-linux-sed-print-only-matching-lines-command/

在本教程中,我发现:

sed -n -e '/regexpA/,/regexpB/p' input.file
Run Code Online (Sandbox Code Playgroud)

上面的命令将同时打印匹配的线条regexpAregexpB,但我会想逃离这两条线段,说这两个匹配线将无法打印到STDOUT,有没有漂亮的解决方案吗?

提前致谢.

Bet*_*eta 5

这个怎么样:

sed '1,/regexpA/d;/regexpB/,$d' input.file
Run Code Online (Sandbox Code Playgroud)