Trim the contents of hostname and hostgroup