When you say extract, what exactly do you mean? Do you want them deleted? Or is it good enough to simply identify them so you can take further action?
Do you care about preserving the original order of lines in the file that needs to change (if a file will change)?
It would be best if you could provide three
sample text blocks (see FAQ, find section on "literal text boxes: used in many other posts on this site).https://community.notepad-plus-plus.org/topic/21925/faq-desk-formatting-forum-posts
Show file1 sample text and file2 sample text, making sure to include both cases that do and do not have matches, maybe 5 - 20 lines each, and then in the third show exactly what you want to end up with.
I’m fairly certain what you want can be done. If order preservation is important it might be a multi-step process.