Help: Search for x and then delete lines start from x to just before y

  • GamMag

    GamMag - 2013-08-30

    I scanning a log file.
    The log file has a line that has a phrase such as "Discarded duplicate request message with switch key" which I will call X.
    After this line there are many lines containing more details about what was logged with regard to X.
    These number of lines can vary.
    A new line/event that was logged will typically start with "8/23/2013". I will call this Y.
    Now, I want to delete everything from X to the line just before Y. Y must not be deleted.

    Then it must carry on searching for the above pattern.

    How do I do this using Search and replace?

    Last edit: GamMag 2013-08-30
  • Loreia2

    Loreia2 - 2013-08-30


    using regular expression option in replace menu (tick . matched newline).

    Search: X.*?(Y)
    Replace: \1