You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working with a hosts file A, which has 50 alphanumerically sorted entries I want, and 49,950 I don't want. I have hosts file B, which has only the 49,950 entries I don't want. I want to use the contents of file B to remove the contents from File A that I don't want. Currently this can only be done with regex S/R expressions. Currently I can search for one line at a time, and replace that no problem, but I can’t just as easily insert the entire hosts lists from file B and replace them all at once. It should be that simple imo. A simple check box to treat each individual contiguous line as its own search & replace in ascending order would be extremely valuable, and would save a lot of people a lot of time and searching around to find the proper expressions.
This problem has been already discussed many times ! So :
You have a first file, named File_A.txt, which contains a list of… whatever you like
You have a second file, named File_B.txt, which contains the same kind of list, with fewer lines than in File_A.txt
And you would like to delete, in File_A.txt, all the lines, which are, ALSO, present in File_B.txt
Wouldn’t you ?
Note that the following regex S/R compares complete lines, only !
Here is the method :
Start Notepad++
Copy/paste all contents of the main File_A.txt file in a new tab
At the end of this main list, add a new line of, at least 3 dashes ( --- )
now, append all contents of the File_B.txt file, AFTER this line
Open the Replace dialog ( Ctrl + H )
Select the Regular expression search mode
Tick the Wrap around option
SEARCH (?-s)^(.+\R)(?=((?s).+?\R)?\1)|(?s)^---.+
REPLACE Leave EMPTY
Click, once on the Replace button or several times on the Replace
Et voilà ! In the new N++ tab, any line, which was, both, present in the two files, has been deleted, as > > well as any possible duplicate lines, in the main File_A.txt file !
The text was updated successfully, but these errors were encountered:
rugabunda
changed the title
FEAT: Option Box to Treat Individual Lines in Replace Dialogue as Independent searches
FEAT: Option Box to Treat Individual Line in Replace Dialogue as Independent searches
Sep 16, 2018
Here is a great example of where the simplicity of this would be extremely useful; taking multiple combined alphanumerically sorted lists, and organizing/separating them by file or by line/section! This is common practice. Having this functionality largely automated, as suggested above would be superb!
I am working with a hosts file A, which has 50 alphanumerically sorted entries I want, and 49,950 I don't want. I have hosts file B, which has only the 49,950 entries I don't want. I want to use the contents of file B to remove the contents from File A that I don't want. Currently this can only be done with regex S/R expressions. Currently I can search for one line at a time, and replace that no problem, but I can’t just as easily insert the entire hosts lists from file B and replace them all at once. It should be that simple imo. A simple check box to treat each individual contiguous line as its own search & replace in ascending order would be extremely valuable, and would save a lot of people a lot of time and searching around to find the proper expressions.
Details here: https://notepad-plus-plus.org/community/topic/16335/multiline-replace-multiple-hosts-in-hostsfile
The text was updated successfully, but these errors were encountered: