I am trying to replace strings found in File1 with strings in File2
File1
<IMG SRC="/Repository/GetImage.dll?baseHref=Orange/2011/03/27&EntityID=Ad12911&imgExtension=" />
<IMG SRC="/Repository/GetImage.dll?baseHref=Orange/2011/03/20&EntityID=Ad13304&imgExtension=" />
<IMG SRC="/Repository/GetImage.dll?baseHref=Orange/2010/08/29&EntityID=Ad13724&imgExtension=" />
File2
/getimage.dll?path=Orange/2011/03/27/129/Img/Ad1291103.gif
/getimage.dll?path=Orange/2011/03/20/133/Img/Ad1330402.gif
/getimage.dll?path=Orange/2010/08/29/137/Img/Ad1372408.gif
When I run this command
$ sed -e 's/.*SRC="\/Repository\([^"]*\)".*/\1/p{r File1' -e 'd}' File2
I get this error
sed: 1: "s/.*SRC="\/Repository\( ...": bad flag in substitute command: '{'
Is there something wrong with my regex?
The result I am trying to achieve would be to have File1 look like:
File1
<IMG SRC="/Repository/getimage.dll?path=Orange/2011/03/27/129/Img/Ad1291103.gif" />
<IMG SRC="/Repository/getimage.dll?path=Orange/2011/03/20/133/Img/Ad1330402.gif" />
<IMG SRC="/Repository/getimage.dll?path=Orange/2010/08/29/137/Img/Ad1372408.gif" />
r
command will read the whole ofFile1
into pattern space each time (and can't be used within a substitute command, as you appear to be trying to do).