How can we perform multiple search for multiple words and the line containing them. These words can be in same or different lines. For example:
1.The CAT goes up and down the ROAD.
2. The DOG goes up and down the CITY.
3. The HORSE goes up and down the TOWN.
4. The DONKEY goes up and down the TOWN.
Now, I wish to do a search for the lines containing CAT and TOWN in one shot. So, I would get the output as line 1, 3, 4 in sequence. That would be the same way we do in Unix (more file | egrep "CAT|TOWN"
).
How can we do it in Notepad++??
Finding a Line in Notepad To go to a specific line, click "Edit" and select "Go To" to display the Go To Line dialog. Type the line number into the field and click "Go To" to find the line. The blinking cursor is positioned at the beginning of the specified line.
You need a new version of notepad++. Looks like old versions don't support |
.
Note: egrep "CAT|TOWN"
will search for lines containing CATOWN. (CAT)|(TOWN)
is the proper or extension (matching 1,3,4). Strangely you wrote and which is btw (CAT.*TOWN)|(TOWN.*CAT)
<shameless-plug>
Search+ is a notepad++ plugin that does exactly this. You can download it from here and install it following the steps mentioned here
Feel free to post any issues/suggestions here.
</shameless-plug>
Possible solution
Screenshot
If you are using Notepad++ editor (like the tag of the question suggests), you can use the great "Find in Files" functionality.
Go to Search → Find in Files (Ctrl+Shift+F for the keyboard addicted) and enter:
Find What = (cat|town)
Filters = *.txt
Directory = enter the path of the directory you want to search in. You can check Follow current doc.
to have the path of the current file to be filled.
Search mode = Regular Expression
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With