ctrl+shift+f & macro
-
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?
-
oh for clarity an example string might be
C:\Users\user\Downloads\4204.mp3\n
and I’d be replacing it with nothing
-
@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.
-
@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.