grep to find ssh key

I have my ~/.ssh/id_dsa file which contains my public ssh key. I need to determine if this key is found in the authorized_keys file. How would I go about grepping this.

This was my original idea:
line=`cat ~/.ssh/id_dsa`
grep "${line?}" authorized_keys

This didn't work because it there are strange characters in the key, not to mention the "------ BEGIN DSA PRIVATE KEY------", the --- gives parsing problems.

I tried using sed as well, but to no avail:
sed -n "s/${line?}/&/p" authorized_keys

I use double quotes for variable substitution, but that will give parsing problems with the key. I think single quotes are the way to go, don't know what to do though. Any thoughts, thx.

Anthony

Try using grep -F/fgrep:

grep -F "$(<id_dsa)" auhorized_keys

If your shell doesn't support the "$(<filename)" syntax use "$(cat filename)".