Replace variable names in text file with its value

Hi

I have a text file (mytext.txt), the content of which is as following:

My name is <@MY_NAME@> and my age is <@MY_AGE@> .

Now i have another property file (myprops) which is as following:

MY_NAME=abcdefgh
MY_AGE=000000

I was wondering, how can i replace the tags of mytext.txt, with its corresponding values in the property file. I tried using sed:
. ./myprops
sed -e "s/<@\(.*\)@>/$(\1)/g" mytext.txt

IN VAIN!!! :rolleyes:

Anyone got ideas??

Thanks.

A possible solution :

awk -F= '
NR==FNR {
   Value[$1] = $2;
   next;
}
{
   text=$0;
   out = ""; 
   while ( pos=index(text, "<@") ) {
      out  = out substr(text, 1, pos-1);
      text = substr(text, pos+2) 
      pos  = index(text, "@>");
      prop = substr(text, 1, pos-1);
      out  = out Value[prop] 
      text = substr(text, pos+2);
   }
   out = out text;
   print out;
}
' myprops.txt mytext.txt

Or

awk -F= '
NR==FNR {
   Value[$1] = $2;
   next;
}
FNR==1 {
   Value[""] = "";
   FS = SUBSEP;
}
{
   gsub(/<@|@>/, SUBSEP);
   out = "";
   for (f=1; f<=NF; f+=2) {
      out = out $f ( $(f+1) in Value ? Value[$(f+1)] : "<@" $(f+1) "@>"i );
   }
   print out;
}
' myprops.txt mytext.txt

Jean-Pierre.