How can I get the following output using linux command by comparing two text files? Thanks.
file1:
site110
site120
file2(Updated):
domain1.com - site110
domain2.com - site111
domain3.com - site112
domain4.com - site113
domain5.com - site120
domain6.com - site1201
domain7.com - site1202
output:
domain1.com - site110
domain5.com - site120
If I use:
grep -f file1 file2
the output will be:
domain1.com - site110
domain5.com - site120
domain6.com - site1201
domain7.com - site1202
which the last two lines are not what I want. Thanks.