Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching multiple files for multiple words

Tags:

notepad++

I have to search trough a huge amount of .txt files. I know I can do multiple words search, but here's my problem. I want my results to only be the .txt files that contain all of the words of the search entry.

For example:

File 1:

test1 

File 2:

 test1  test2 

Search files for test1 and test2 will only result in showing File 2.

Hope someone can help me out. Thanks

like image 379
Steelduines Avatar asked Aug 31 '12 13:08

Steelduines


People also ask

How do I search for multiple files in a string in Windows?

Select Search > Find in Files from the menu. If you like keyboard shortcuts better, use Ctrl-Shift-F to open the search window instead. The find in files configuration window is pretty easy to use as you can ignore most options if you don't require them.


2 Answers

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 = (test1|test2)
  • 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
like image 122
Jean-Francois T. Avatar answered Oct 08 '22 19:10

Jean-Francois T.


If you are using Notepad++ editor Goto ctrl + F choose tab 3 find in files and enter:

  1. Find What = text1*.*text2
  2. Filters : .
  3. Search mode = Regular Expression
  4. 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.
like image 22
HungSmile Avatar answered Oct 08 '22 19:10

HungSmile