在多个文件中搜索多个单词
我必须搜索大量的 .txt
文件.我知道我可以进行多词搜索,但这是我的问题.我希望我的结果只是包含搜索条目所有单词的 .txt
文件.
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.
例如:
文件 1:
test1
文件 2:
test1
test2
搜索test1
和test2
的文件只会显示文件2.
Search files for test1
and test2
will only result in showing File 2.
希望有人能帮助我.谢谢
Hope someone can help me out. Thanks
如果您使用的是 Notepad++ 编辑器(如问题标签所示),您可以使用出色的在文件中查找"功能.
If you are using Notepad++ editor (like the tag of the question suggests), you can use the great "Find in Files" functionality.
转到搜索>在文件中查找(Ctrl+Shift+F为键盘上瘾)并输入:
Go to Search > Find in Files
(Ctrl+Shift+F for the keyboard addicted) and enter:
- 查找内容 =
(test1|test2)
- 过滤器 =
*.txt
- Directory = 输入你要搜索的目录的路径.你可以勾选
Follow current doc.
来填充当前文件的路径. - 搜索模式 =
正则表达式
- 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