Vim search for a pattern and if occurs delete to end of line

后端 未结 4 1793
鱼传尺愫
鱼传尺愫 2021-01-31 08:25

I am trying to search a text file for a certain pattern. If this pattern occurs then it means that the rest of the line is not needed and therefore can be deleted.

I ha

4条回答
  •  深忆病人
    2021-01-31 08:48

    To replace a pattern and whatever else use the regular expression wild card .*

    :1,$s/pattern.*//g
    

提交回复
热议问题