in reply to String substitution
s/$old_hostname/$new_hostname/sgi [download]
Note: You may also want to add \Q and \E around your $old_hostname if you don't want any special regex characters in there to affect the match.
s/\Q$old_hostname\E/$new_hostname/sgi [download]