How to mark all lines that contains a word in multi files at once and then delete all non marked lines from all open files



  • Hi all , i have a question for you guys

    How to mark all lines that contains a word in multi text files at once and then delete all non marked lines from all open files

    if i have 50 text files or more and i want to keep the lines that only contains 123 FOR EXAMPLE

    I dont want to go over each page and mark the lines then go to search and book mark and then remove un marked lines please give me an easier way or add mark all in all open pages button so i can select it and also another button remove un marked lines from all open pages , thanks in advance.



  • Better solution with regex replace:

    (?!^.SOMETEXT.$)^.+\r?\n
    And replace with nothing

    answered May 1 at 14:37

    LoneDev

    STILL NEED the options in the next version please it will help alot thanks.



  • Hello, @hamada-re3oo and All,

    I suppose that, due to the Markdown syntax, in our forum, some star symbols ( * ) miss in your regex ;-))

    So, in order to delete any line, even empty, of a file, which does NOT contain a specific text, a correct and simplified version could be :

    SEARCH (?-is)^(?!.*Some text).*\R , for a sensitive to case search

    OR

    SEARCH (?i-s)^(?!.*Some text).*\R , for an insensitive to case search

    REPLACE Leave Empty

    For instance, the regex (?-is)^(?!.*Fix).*\R would delete any line, even empty, of the change.log file, which does not contain the word Fix, with that exact case

    Best regards,

    guy038



  • @Hamada-re3oo
    side note on posting:

    if you want to post text with special characters,
    you can type it it in between `` back ticks (accent grave)

    example:

    `my text with special *characters* **&%$&**`
    

    will be displayed correctly as
    my text with special *characters* **&%$&**
    instead of
    my text with special characters &%$&


Log in to reply