Here's a grep -f method that doesn't use a lot of memory, but takes a long time:
cat f1 | \
while read f1rec; do
fgrep -- "$f1rec" f2 >/dev/null || echo -- "$f1rec"
# The -- may not work in all UNIX's -
# they are to ensure that records beginning with a record starting
# with "-" will not be interpreted as an option
done
That will find all the records in f1 not in f2. Just swap the variables to do the reverse effect.
If all you want to do is merge the files, and no duplicates are allowed, here you go: