sed: return last occurrence match until end of file

前端 未结 6 1456
名媛妹妹
名媛妹妹 2020-12-10 15:29

Using sed, how do I return the last occurance of a match until the End Of File? (FYI this has been simplified)

So far I\'ve tried:

sed -n \'/ Statist         


        
6条回答
  •  清歌不尽
    2020-12-10 16:20

    This might work for you:

    sed '/Statistics/h;//!H;$!d;x' file
    Statistics |
       Stuff
    Error: error type one
    Error: error type two
    

提交回复
热议问题