.... > They have some lines in common > and some lines are unique to one of the files. Use comm whenever you are dealing with set operations (in your case the intersection operation): http://www.catonmat.net/blog/set-operations-in-unix-shell -- Eitan Adler