在多个文件中搜索多个单词 [英] Searching multiple files for multiple words

查看:62
本文介绍了在多个文件中搜索多个单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须搜索大量的 .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

搜索test1test2 的文件只会显示文件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

这篇关于在多个文件中搜索多个单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆