Community
    • Login

    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

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 3.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Hamada re3ooH
      Hamada re3oo
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • Hamada re3ooH
        Hamada re3oo
        last edited by

        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.

        Meta ChuhM 1 Reply Last reply Reply Quote 0
        • guy038G
          guy038
          last edited by

          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

          1 Reply Last reply Reply Quote 1
          • Meta ChuhM
            Meta Chuh moderator @Hamada re3oo
            last edited by

            @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 &%$&

            1 Reply Last reply Reply Quote 2
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors