简体   繁体   English

Bash:grep -i -vFf

[英]Bash : grep -i -vFf

I have 20 files. 我有20个档案。 In each file I have a list of the occurring words and their frequency. 在每个文件中,我都有一个出现单词及其频率的列表。 example

5 hi
10 test
20 bye 
5 Hello

etc 等等

And another file in which there is a list of words. 另一个文件中有单词列表。

hi   
Hello 
goodbye

How can I use one grep -v on all of these ? 如何在所有这些上使用一个grep -v?
I tried 我试过了

for i in  {1..20} ; 
do
grep -i -vFf ./../data/input/blacklist.txt ./../data/dico/$i.dico.forme.lemme.txt > ./../data/selection/$i.select.txt  ;
done

But it didn't work. 但这没有用。
What I expect was to have 我所期望的是

10 test
20 bye

what I get 我得到什么

5 hi
10 test
20 bye
5 Hello

So, I created the files according to your specification and dit the grep: 因此,我根据您的规范创建了文件并删除了grep:

ljm[tmp]$ cat lemme
5 hi
10 test
20 bye 
5 Hello
ljm[tmp]$ cat blacklist
hi
Hello
ljm[tmp]$ grep -ivf blacklist lemme 
10 test
20 bye 

This means that it should work. 这意味着它应该工作。 Apparently, you are doing something different than you stated in your question. 显然,您所做的事情与您在问题中所说的有所不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM