Regular Expressions - How to Delete Two Lines, If one contains X?

Discussion in 'Programming' started by JohnS0N, May 7, 2010.

  1. #1
    So I have a file and need to delete all instances that contain a certain string in the first line. Also Each line below the line that contains that string should also be completely deleted (no matter what it is). How do I make this happen?

    Now obviously the expression for finding that first line is:

    ^.*STRING.*$

    After that I'm stuck.

    In other words I need to delete TWO lines and the first line contains my string.
     
    JohnS0N, May 7, 2010 IP
  2. JohnS0N

    JohnS0N Notable Member

    Messages:
    1,581
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    210
    #2
    Or alternately I could delete the line that is below the blank line. How?
     
    JohnS0N, May 7, 2010 IP