In this case something in the variable RPM_INSTALL_PREFIX is triggering this error and I'm pretty sure it is one or more /
in the string! If this is the case, a workaround would be translate the / to something else, do the substitution with sed and then translate back. For example:
> cat test.txt # this is my test file
> export RPM_INSTALL_PREFIX=/usr/local
> eval sed -e \'s/usrshare/$RPM_INSTALL_PREFIX/g\' test.txt
sed: -e expression #1, char 13: unknown option to `s'
> export TR_INSTALL_PREFIX=`echo $RPM_INSTALL_PREFIX | tr "/" "@@@"`
> cat test.txt | sed -e s/usrshare/$TR_INSTALL_PREFIX/g| tr "@@@" "/"
I suppose there is no "@@@" sequence of character in your install prefix, nor in the spec file. However I'm sure there is a better way to do this. Probably some sed guru will know!
Edit: of course the eval command is not needed anymore!