compare two files and get the output for the same lines

Posted by garconcn on Stack Overflow See other posts from Stack Overflow or by garconcn
Published on 2010-05-14T17:35:15Z Indexed on 2010/05/14 17:44 UTC
Read the original article Hit count: 220

Filed under:
|

How can I get the following output using linux command by comparing two text files? Thanks.

file1:

site110
site120

file2:

domain1.com - site110
domain2.com - site111
domain3.com - site112
domain4.com - site113
domain5.com - site120

output:

domain1.com - site110
domain5.com - site120

© Stack Overflow or respective owner

Related posts about linux

Related posts about bash