Compare two string in two separate file and delete some line of file

Hi all
i want to write program with shell script that able compare two file content and if one of lines of file have # at the first of string or nothing find same string in one of two file . remove the line in second file that have not the string in first file. for example:

file 1:config-file.conf
{
</sound>
snd sound card
snd1 sound card
<sound>
}
if user put # at first of string and save it , like: # snd sound card in config file
the program goes to second file for example
blacklist-sound.conf
{
blacklist snd sound card
blacklist snd1 sound card
}
and delete line blacklist snd sound card

or if user delet snd sound card string in config file , and then save it.program can remove blacklist snd sound card line
in blacklist -sound.conf

sorry for bad English
than x

---------- Post updated at 02:43 PM ---------- Previous update was at 02:30 PM ----------

I should mention that both are required to be written in one shell script .means both
put # and remove string method work whit gather.
than x

Try this code and verify if you are getting desired output:-

grep "^#" config-file.conf | sed 's/#//g' | while read line
do
        grep -v "${line}" blacklist-sound.conf
done

If yes, then you can redirect the output to a temporary file and rename it back to original file: blacklist-sound.conf

One way with assumptions:

awk 'FNR==NR{if(/^#/) {gsub(/^#[ \t]*|[ \t]*$/,"");del[$0]}
else if(!/^[ \t]*(\{[ \t]*$|<)/) {gsub(/^[ \t]*|[ \t]*$/,"");exists[$0]};next}
{t=$0;if(sub(/^[ \t]*blacklist[ \t]*/,"",t) && ((t in del) || !(t in exists))) next}1' config-file.conf blacklist-sound.conf