in reply to comparing arrays

I need to do this sort of thing (and similar related things) a lot in my work, so I wrote my own command line utility to handle it, and posted it here (cmpcol) at PM.

For the case you cited, the command line would be:

cmpcol -i -l2 file1 file2
where "-i" means "output the intersection of the two files", and "-l2" means "output full lines from file2 for matches". It has lots of other bells and whistles (union or exclusive-or instead of intersection, using other columns in either file instead of the default first column, etc). HTH.