Please help with find and replace:

Hi

I am trying to find a product code hightlighted in red, and re-insert it at another place on the same file. I shall be grateful if anyone can help me with this. Stuck and have deadline!!:confused:

Original Line: (I can get source data in one of these two formats)
ISD=977155185403901+DIE CAST+DIE CAST 055555+01087+001008+SPR 08+08+004+Y'
OR
ISD=977155185403901+DIE CAST+DIE CAST?+55555+01087+001008+SPR 08+08+004+Y'

I want to change it to:

ISD=977155185403901+DIE CAST+DIE CAST+55555:01087+001008+SPR 08+08+004+Y'

I have thousands of ISD records to go through and fix this. The product code (55555 in above example) will be different in all lines. Please help.

$ cat data
ISD=977155185403901+DIE CAST+DIE CAST 055555+01087+001008+SPR 08+08+004+Y'
ISD=977155185403901+DIE CAST+DIE CAST?+55555+01087+001008+SPR 08+08+004+Y'
$ sed 's/CAST 0\([0-9]*\)+/CAST+\1:/;s/CAST\?+\([0-9]*\)+/CAST+\1:/' data
ISD=977155185403901+DIE CAST+DIE CAST+55555:01087+001008+SPR 08+08+004+Y'
ISD=977155185403901+DIE CAST+DIE CAST+55555:01087+001008+SPR 08+08+004+Y'
$

try this 1,$s'old text'newtext'