How do I substitue a variable in sed ?

From: Dr. David Kirkby (see_my_signature_for_my_real_address_at_hotmail.com)
Date: 08/12/04


Date: 12 Aug 2004 11:43:06 -0700

I have a short script in which the varable date_and_time is set to
today's date/time. I'd then like to find all lines in a list of html
file that have the words 'Last modified: ...' on the line, and
substitute it with 'Last modified: xxx' where xxx is the date and
time.

The problem is, if I set a variable date_and_time to 12 Aug 20:40, I
end up with the sed script either substituting

a) $date_and_time
b) date_and_time
but never
c) 12 Aug 20:40.

Bascically I need to refer to $date_and_time in the sed substritution,
but I can I ??

Here is my script.

sparrow /var/apache/htdocs/Southminster-branch-line # modified
#!/bin/sh
# The aim of this script is to substitute any line beggining:
# Last modified:
# in an html file with:
# Last modfied date_and_time
# where date_and_time is the time the file was last modified.
for file in `ls *.html`
do
  # This gets the date/time, and puts it into the variable
date_and_time
  date_and_time=`ls -l $file | awk '{print $7,$6,$8}'`

  # Now how do I get sed to put this in ????

  sed 's/^Last modified:.*/Last modified:$foo/g' $file
done
~