如何在文本文件中查找单词计数,不包括一个用户给定的单词

sri*_*eni 2 linux text-processing

我有大量的文本文件。其中,每篇文章都由15 stopwords. 我想找出该文件中的总字数,不包括stopword

Sté*_*las 5

使用 GNU grep:

grep -Eo '\S+' < file | grep -vcxF stopword
Run Code Online (Sandbox Code Playgroud)

将计数(-c)字的(具有相同的定义的数目字作为的wc -w的有效文本,至少,即非空格字符序列(\S+))不属于(-v)完全相同(-xF)stopword。