How do I insert text with sed ?

Hi I was wondering if anyone new of a solution to this problem? I need to copy a time stamp that is on a line of .text in a text file into multiple positions on the same line.
I need to insert the time stamp on the same line between every occurance of the text ".pdf_.html" right after the underscore and before the ".html"
I've tried using sed and the \1 function without much luck.
I would be very thankful if anyone was able to provide a solution.
Below is an example of the code I'm trying to use.

 sed 's/\(TIMESTAMP\)/.*.pdf_\1.html.*/g' /SubmissionForm/*.text 

What this sed script does is find the one occurrence of the time stamp on the line and inserts
".pdf_.html" around it, which is sort of what I had intended but not quit, I actualy need the time stamp to be inserted between every occurance of ".pdf_.html" after the underscore and before the .html
any help would be much appreciated
thanks

echo '.pdf_.html' | sed "s/pdf\_/&$timestamp/"

.pdf_Mar-05-2013-10:22:19.html

Something like this?

timestamp=`date +%Y-%m-%d-%H-%M`
sed 's|\(\.pdf_\)\(\.html\)|\1'"$timestamp"'\2|g' /SubmissionForm/*.text

Please show a sample line and what the output should look like.

Your s command is almost certainly screwed up.

Using the syntax s/A/B/ why do you put .* in the B part?

You have:

s/\(TIMESTAMP\)/.*.pdf_\1.html.*/g

It would help to have example desired input / output.

Maybe I should expailed myself more thoroughly. What I am trying to do is pick up a string of text from the begining of the line, an example of the string is this: "05-03-2013-08-59-16", this string is actualy a time stamp, that is associated with a number of file names that appear later on in the same line. The file names all end the same way, that is with a ".pdf_.html" I need to insert the string from the beginning of the line between the ".pdf_" and the ".html" everytime there is an occurance of ".pdf_.html"
Here is an example of the original text file:

<textarea name="file_links" value='05-03-2013-08-59-16 http://216.234.35.180/SCL_Preflight_Report_Page/1 small_format_stores_sign_tyr_5xpoints_22x28.pdf_.html http://216.234.35.180/SCL_Preflight_Report_Page/2 898611_Ped_Markham Reno_FINAL.pdf_.html'

And the following is the way I need it to look:

<textarea name="file_links" value='05-03-2013-08-59-16 http://216.234.35.180/SCL_Preflight_Report_Page/1 small_format_stores_sign_tyr_5xpoints_22x28.pdf_05-03-2013-08-59-16.html http://216.234.35.180/SCL_Preflight_Report_Page/2 898611_Ped_Markham Reno_FINAL.pdf_05-03-2013-08-59-16.html'

Also string that represents the time stamp will never be constant except for the format of numbers and dashes, and I need to perform the same operation on a number of files with changing time stamps and filenames.
The only constant will be the format of the timestamp and the position of the string: ".pdf_.html" at the end of the file names
thanks very much for all your help

You mean something like this?

TS=05-03-2013-08-59-16; sed "/$TS/ s/\.pdf_\.html/.pdf_$TS.html/g" infile

or do you mean:

sed "s/\(.*value='\)\([^ ]*\)\(.*\.pdf_\)\(\.html.*\)/\1\2\3\2\4/g" file
 export Timestamp=$(grep -o '..-..-....-..-..-..' file);sed "s/pdf\_/&$Timestamp/g" file

<textarea name="file_links" value='05-03-2013-08-59-16 http://216.234.35.180/SCL_Preflight_Report_Page/1 small_format_stores_sign_tyr_5xpoints_22x28.pdf_05-03-2013-08-59-16.html http://216.234.35.180/SCL_Preflight_Report_Page/2 898611_Ped_Markham Reno_FINAL.pdf_05-03-2013-08-59-16.html'

Hi Thanks, I modified this script somewhat, I believe I am picking up a new line character from the grep statement. When I run this code in a shell; I am getting the following error

sed: 1: "s/pdf_.html/pdf_05-03-2 ...": unescaped newline inside substitute pattern

here is an example of the code I am using:

export Timestamp=$(grep -o '[0-9]*-[0-9]*-[0-9]*-[0-9]*-[0-9]*-[0-9]*' file);sed "s/pdf_.html/pdf_$Timestamp.html/g" file

I am out of my depth with this problem if any one knows of a solution It would be greatly appreciated.
Thanks

grep -o produces every match in the file on a new line, so yes you will likely end up with newlines inside the Timestamp variable.