I have two files: in linux redhat version 6
list1.txt - this files contain 34732 words
list2.txt - this files contain 272 words
I want to remove all words from list1.txt that spears from list2.txt
what the best approach to do that ( both files include only one field )
more list1.txt
dweferf
fr
grgr
gefyh
fergtrg
ggtgg
fergth
gtg
.
.
.
more list2.txt
dweferf
fr
frgrgggb
rggtgtrgrt
fergtrg
rfergrtg
fwed4
.
.
.
grep -Fxvf list2.txt list1.txt
would be better option.. will ensure that for ex:fr
in list2.txt won't matchfree
in list1.txt...-F
since we don't need regex here,-x
to match only whole line – Sundeep Jan 24 '17 at 11:33comm -23 <(sort list1.txt) <(sort list2.txt)
– Sundeep Jan 24 '17 at 11:34