Delete line



  • Hi, I’ve one txt file like this:
    Title: Fred Montana
    Date: 31 Avril 2017

    Title: Doors
    Date: 22 may 2015

    etc…

    I want delete all lines with Date: …

    I I’ve try with search & replaced with extended mode and entry Date: .* but not work…
    How to del all line with text Date: … ??



  • Hello, @renso-petrulli,

    Very easy, indeed ! You should have tried the Regular expression mode, instead :-))

    SEARCH (?-i)^Date.*\R?

    REPLACE Leave EMPTY

    Notes :

    • The first part (?-i) forces the search to be sensitive to case. If the word Date may have any case, change for (?i)

    • Then, the ^ symbol is an zero-length assertion, which means beginning of Line

    • The part Date.* represents the word Date, followed by any range of characters, even empty

    • Now, the \R syntax stands for any line-break ( End of Line characters )

    • Finally, the ? quantifier, equivalent to {0,1} means that the line-break may be present or NOT ( case of a last line Date…, without any line-break, at its end ! )

    • As the replacement zone is empty, the entire current line is deleted


    Note the difference with the following S/R

    SEARCH (?-i)^Date.*

    REPLACE Leave EMPTY

    In that case, any line, beginning with the word Date, is replaced by a pure blank line

    Best Regards,

    guy038



  • Yes! Thank you very much!
    Regards. RP


Log in to reply