in reply to Re: extract uniques and sort
in thread extract uniques and sort

if the hosts are all internal ( e.g. within a company intranet ), you can use Fastolfe's trick if you add the domain name to the hostname first

 $host .= '.foo.com' unless $host =~ /.foo.com$/;

admittedly lazy, but i do use the trick here at work all the time. then, the problem of host vs host.foo.com (which are the same) is resolved.

the IP resolution trick might not work for hosts w/ more than one IP address ( routers, for one )

Replies are listed 'Best First'.
RE: RE: Re: extract uniques and sort
by Fastolfe (Vicar) on Sep 21, 2000 at 17:32 UTC
    That isn't really necessary. So long as your domain is properly configured in your network subsystem (e.g. in /etc/resolv.conf), attempting to resolve "www" is equivalent to resolving "www.example.com".

    If you want to skip the step of actually attempting to resolve the hostnames, you can try to parse /etc/resolv.conf yourself and tack on each of the 'search' or 'domain' items (not sure what all is used), since you could technically have more than one. But if it's a custom app just for 1 location/purpose, I guess you could hard-code it without worry.

      it's actually easier to do it that way. my intranet is globally distributed, and /etc/resolv.conf isn't going to contain every host/ type of host.

      but for others, it's probably a valid approach.