The following regex is more better
/bin/sed -i "/^[127|localhost]/s/${CURRENT_HOSTNAME}/${NETCFG_HOSTNAME}/g" /etc/hosts
The following regex is more better
/bin/sed -i "/^[127| localhost] /s/${CURRENT_ HOSTNAME} /${NETCFG_ HOSTNAME} /g" /etc/hosts