• Login
Community
  • Login

ctrl+shift+f & macro

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 357 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.
  • N
    nick klaus
    last edited by Nov 15, 2021, 7:00 AM

    I have a list of strings and I want to remove those strings from other lists with np++.

    A single string is easy, just highlight, ctrl+shift+f, click replace. [click are you sure, yes I’m sure!] Delete the highlight, on to next string.

    But I have a few thousand of these to do.

    Recording a macro doesn’t update the replace dialogue [and persists in asking are you sure?, I was sure when I recorded the macro]

    Any suggestions?

    N 1 Reply Last reply Nov 15, 2021, 7:07 AM Reply Quote 0
    • N
      nick klaus @nick klaus
      last edited by nick klaus Nov 15, 2021, 7:07 AM Nov 15, 2021, 7:07 AM

      oh for clarity an example string might be

      C:\Users\user\Downloads\4204.mp3\n
      

      and I’d be replacing it with nothing

      N 1 Reply Last reply Nov 15, 2021, 8:42 AM Reply Quote 0
      • N
        Neil Schipper @nick klaus
        last edited by Nov 15, 2021, 8:42 AM

        @nick-klaus Hi. You didn’t explicitly say that you need to operate on several or many files, although this is implied.

        When you say “a few thousand of these” I presume you mean strings, and more precisely, that you have a text file containing one such string per line.

        It would be good to know if each and every string to remove is a conventional Windows path, and if so, if there are other characteristics common to them.

        It would be good to know if the overall operation will leave some other Windows paths in the target files undisturbed.

        So, I feel like I’m making some guesses about your requirements; you might have made a greater effort to reduce ambiguity.

        Anyway, here is a broad strategy:

        Phase 1: a regex (or maybe a few macros) converts your list of strings into a large regex that specifies the (logical) OR of all of the strings. The process would need to insert escapes for all the special chars (backslashes, periods, etc).

        Phase 2: run this new regex against all your files.

        Phase 1 may not be feasible due to bumping against npp’s regex char limit, in which case breaking the job into hundred-ish string batches might be necessary.

        N 1 Reply Last reply Nov 15, 2021, 11:21 AM Reply Quote 0
        • N
          nick klaus @Neil Schipper
          last edited by Nov 15, 2021, 11:21 AM

          @neil-schipper thanks for the reply.
          many files [actually .m3u music playlists]
          I’m removing tracks I no longer own from .m3u history lists.

          yes I mean 1000’s of strings.
          They should be windows paths in 99% of cases but can’t rule out something being not strictly windows.

          Your method sounds solid, I made a AHK style c++ app to do the job, it’s slow but this is a once a year bit of house keeping so no need to be fast.

          I’ll keep your method in mind for similar smaller projects. Thanks again.

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