& is special in the replacement text: it means “the whole part of the input that was matched by the pattern”, so what you're doing here replaces
user=user=&uidXsysuserid.. To insert an actual ampersand in the replacement text, use
Another thing that looks wrong is that
. in the search pattern stands for any character (except a newline), but the
. at the end of the replacement text is a literal dot. If you want to replace only the literal string
user=&uid., protect the
. with a backslash.
sed -e 's/user=&uid\./user=\&sysuserid./g'
If you want to replace any one character and preserve it in the result, put the character in a group and use
\1 in the replacement to refer to that group.
sed -e 's/user=&uid\(.\)/user=\&sysuserid\1/g'
In fact, given the repetition between the original text and the replacement, you should use groups anyway:
sed -e 's/\(user=&\)u\(id\.\)/\1sysuser\2/g'