that's what i was thinking initially - get the common lines, feed them to sed and call it a day.
But then i started thinking - isn't it too much of file reading for such a simple operation - read 2 files to get common. Store in a third file. Read two files again to find matching lines and store the output to the final one.
There got to be a utility that does just this one step. So for now i settle with "ugly" approach, but i'm still left wondering...