Search and assign using sed

Hi,
I would like to know how to search for a pattern in a file and assign it to a variable using sed.

For example, my hope.txt
address1=123 street,abc city,xyz
address2=456 street,abc city,xyz

In my script I would like to search for patter "address1" and assign the complete line into a variable "A1". How do I do that?

Thanks,

Use the right tool, which in your case is awk, not sed.

Thanks, How do I do that using awk?

Why sed only, is this a homework ? .. anyway

var=$(sed '/address1/s/.*=\(.*\)/\1/p;d' file)

---------- Post updated at 07:43 PM ---------- Previous update was at 07:34 PM ----------

hmm... I didn't seen that you are open for other solution.
Shell only:

pattern=address1
var=""
while IFS=\= read pat adr
do 
    case $pat in 
        $pattern ) var=$adr;break;;
    esac
done< file
echo $var

or, something like:

pat=address1
addr=$(sed -n "s/^$pat=//p" infile)

Thanks a lot man.