sed
正規表現に一致するもの (包括的) から他の正規表現に一致するもの (包括的) に印刷行を作成する方法ですが、条件が追加されています - 終了正規表現がまったく存在しない可能性があります。
例 1 (区切り正規表現として^START.*
andを想定):^END.*
cruft1
cruft2
START print this
print this
print this
END print this too
cruft
例 2:
cruft1
cruft2
START print this
print this
print this
- file ends here
サブ質問: そのような最初の出現のみを出力します。