Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个文本文件[带有行的原始文件和带有关键字的字典文件]。在原始文件中搜索字典文件中的每个单词,如果有匹配项,则在原始文件中匹配行旁边打印字典单词。
您可以使用该选项告诉grep从文件中读取模式。-f您还可以使用该-w选项仅搜索单词。
grep
-f
-w
grep -wf dictionary.txt rawfile.txt