How to select lines between two marker patterns which may occur multiple times with awk/sed

前端 未结 9 1352
离开以前
离开以前 2020-11-22 04:41

Using awk or sed how can I select lines which are occurring between two different marker patterns? There may be multiple sections marked with these

9条回答
  •  我寻月下人不归
    2020-11-22 05:32

    This might work for you (GNU sed):

    sed '/^abc$/,/^mno$/{//!b};d' file
    

    Delete all lines except for those between lines starting abc and mno

提交回复
热议问题