Notepad will only delete the specific phrase, not the entire line containing the phrase.
This batch file will do it. Edit the 3 set lines as needed. The set phrase line must have the quotes shown in red; don't use
", <, >, %, or | in the search phrase. Some other punctuation might also cause incorrect results.
This is not case sensitive, it you need it to be case sensitive, remove the /I switch.
You can have the program delete the original and rename the new file if you wish, but best to test first to make sure it's doing what you want.
Code:
@Echo Off
Set _SourceFile=C:\Test1\test.txt
Set _NewFile=C:\Test1\testv2.txt
Set _Phrase="Don't want lines with this phrase"
>"%_NewFIle%" Findstr /I /V %_Phrase% "%_SourceFile%"
Edit: adding the red quotes changed the spacing, it should be spaced like this:
Set _Phrase="Don't want lines with this phrase"
HTH
Jerry