How to find and replace line(s) in multiple files using Notepad++?
I have been messing with notepad++ for a bit now and am confused as to how to go about doing this:
I have a line in multiple files (Within a root directory) that I am searching for. Example:
Brittany (File 1)
PeopleSleptWith 2
Tiffany (File 2)
PeopleSleptWith 4
Bonqueesh (File 3)
PeopleSleptWith 3456
.
.
.
My goal is to replace all of the PeopleSleptWith
lines with a constant (I.E. PeopleSleptWith 7
) but when I search and replace in multiple files, it does not remove complete line, which results in:
Brittany (File 1)
PeopleSleptWith 7 2
Tiffany (File 2)
PeopleSleptWith 7 4
Bonqueesh (File 3)
PeopleSleptWith 7 3456
When in reality I want:
Brittany (File 1)
PeopleSleptWith 7
Tiffany (File 2)
PeopleSleptWith 7
Bonqueesh (File 3)
PeopleSleptWith 7
So how do i go on about finding a string, removing everything within that line, and replacing it with another string?
Using Notepad++ to find a string on a line in a file, and replace that entire line with the match with another string
Instructions
Open Notepad++ and press
Ctrl
+F
and then from theFind in Files
tab options.Now you'll...
Put the string in the regex format of the Find What:
^.*(PeopleSleptWith).*$
- The string will go between the "
()
" parenthesis just as shown above in#1
Put the 5 spaces and then the Replace with:
PeopleSleptWith 7
string- Put the Filters: as
*.*
or*.txt
or whatever you are replacing file type wise- Put the Directory: where you want it to be (the root folder)
- Check the
Regular expression
option- Select
Replace in Files
Check the file(s) and all should be correct now