Reputation: 1761
I have two files test1
and test2
test1
foo
bar
hello
world
test2
bar
world
hello
and I really want to obtain foo
here, could anybody help me? please ..
Upvotes: 1
Views: 54
Reputation: 205
If you have vim installed, you can use :
vimdiff test1 test2
But it's just to edit files. If you only just want foo appears on the screen it's not what you want
Upvotes: 0
Reputation: 113994
To print all the lines in test1 which are not also in test2, run:
$ grep -vFf test2 test1
foo
The options to grep have the following meanings:
-v
Print only lines that do not match any of the patterns.
-F
Interpret the patterns as fixed strings, not regex.
-f test2
Read the patterns from test2.
Upvotes: 6