我想将grep和停用词文件一起使用,以从另一个文件中过滤掉常见的英语单词。文件“somefile”每行包含一个字。使用grep从停用词文件中过滤掉单词
cat somefile | grep -v -f stopwords
这种方法的问题是:它检查在停用词一个词是否在somefile发生,但我想如果somefile一个词停用词出现相反的情况,即检查。
如何做到这一点?
例
somefile包含以下内容:
hello
o
orange
禁用词包含以下内容:
o
我想从somefile过滤出个 “o”,而不是你好,橙子。
或'grep -v -w -f stopwords somefile'避免了'cat'命令 – Matthias
我根据你的清理建议改变了答案@Matthias –