Community
    • Login

    Something amazingly useful I fear is not a thing regarding deleting text

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 3 Posters 413 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.
    • Craig BeringhausC
      Craig Beringhaus
      last edited by

      I am an admin. It look at mountains of log files. Often I need to just pass or keep sections of the logs.
      I would like to know if there is a way to ‘crop’ my text files.
      By this, I mean I want to highlight a certain portion of text and then delete everything that is NOT highlighted with a right click or shortcut key.
      I AM AN ADMIN. I repeat this to make clear I am obviously aware how to copy paste. I do not wish to create a new document. I wish to flush unnecessary miles of my current document.
      Is this possible?
      Thank you for your time.

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Craig Beringhaus
        last edited by

        @Craig-Beringhaus

        Most useful for you would be an “Invert Selection” command, that would take your current selection and select everything else. Then a tap of the Delete key and you are done.

        Alas, there is no such command in Notepad++.

        Plus, it is complicated, because it would require “multi-select” to be enabled, because in most cases, you would need such a selection inversion command to select a block before your selection and a block after your selection.


        But all is not lost…

        A simple thing that seems to work is to record a macro for the following actions, in order:

        • Copy (Ctrl+c)
        • Select All (Ctrl+a)
        • Paste (Ctrl+v)

        Then you give it a name and assign a keycombo to it.
        When you want to actually use it, you select the text you want to keep, then run the macro via the assigned keycombo.

        Of course, the slight downside may be that it destroys your clipboard contents, but perhaps this is a small deficiency.

        Craig BeringhausC 1 Reply Last reply Reply Quote 3
        • Craig BeringhausC
          Craig Beringhaus @Alan Kilborn
          last edited by

          @Alan-Kilborn
          Thank you!
          Sad that it’s not pre-existing, but you think outside the box. I like it!

          1 Reply Last reply Reply Quote 1
          • EkopalypseE
            Ekopalypse
            last edited by

            @Craig-Beringhaus
            and there is this copy styled text feature in the search menu,
            which could be used within the macro if more than one block of text is highlighted

            Alan KilbornA 1 Reply Last reply Reply Quote 1
            • Alan KilbornA
              Alan Kilborn @Ekopalypse
              last edited by

              @Ekopalypse said in Something amazingly useful I fear is not a thing regarding deleting text:

              and there is this copy styled text feature in the search menu,
              which could be used within the macro if more than one block of text is highlighted

              Actually, if Multi-Editing is enabled, the original macro handles “more than one block” just fine, no need to dabble in “styles” or “Copy Styled Text”.

              e43a4b11-11a5-4605-a058-9ec00f471712-image.png

              1 Reply Last reply Reply Quote 0
              • EkopalypseE
                Ekopalypse
                last edited by

                Yes, but copy selected text does not need to have multiple selections active at the time of doing the copy.

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