in reply to String substitution

If you don't want to match against word boundries \b, then remove those constraints from the regex. ie.
s/$old_hostname/$new_hostname/sgi

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