hostname is defined in the $SPLUNKHOME/etc/system/local/inputs.conf. If you want to push out a standard inputs.conf to multiple splunk instances you have a few options:
Use a deployment server, creating a new app with your inputs.conf to be shipped out. A little bit up front setup time, but easy to manage many hosts. http://www.splunk.com/base/Documentation/latest/Admin/Aboutdeploymentserver
If you want to manually (or via script) do this, simply place the inputs.conf into $SPLUNKHOME/etc/apps/search/local. The inputs.conf at this location does not define the hostname, so you don't have to worry about overwriting it by accident or setting it yourself.
Take a look at the configuration file reference in the documentation, this should make a lot more sense then. http://www.splunk.com/base/Documentation/latest/Admin/Wheretofindtheconfigurationfiles
... View more