I have two files - file1 & file2.
file1
contains (only words):
ABC
YUI
GHJ
I8O
file2
contains many paragraphs:
dfghjo ABC kll
njjgg bla bla GHJ
njhjckhv chasjvackvh ..
ihbjhi hbhibb jh jbiibi
I am using the command below to get the matching lines which contains word from file1
in file2
:
grep -Ff file1 file2
(Gives output of lines where words of file1
found in file2
)
I also need the words from file1
which are not found in file2
.
Can anyone help in getting this output:
YUI
I8O
I am looking for a one liner command (via grep
, awk
, sed
), as I am using pssh
command and can't use while
or for
loops.