Bash : grep -i -vFf

I have 20 files. 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 ?
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

1 answer

  • answered 2018-01-14 13:19 Ljm Dullaart

    So, I created the files according to your specification and dit the 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.