in reply to matching a line from one file in another

You can also just use the *nix command-line utility join (it supports reading from STDIN) ..
join - hosts.txt # and type/paste in the input ./some_program | join - hosts.txt # pipe the input in

Replies are listed 'Best First'.
Re^2: matching a line from one file in another
by Thelonius (Priest) on Apr 14, 2006 at 19:06 UTC
    But remember that both input files need to be sorted. The examples were, but if not, you would have to sort them before the join.