jorain has asked for the wisdom of the Perl Monks concerning the following question:
<readme> The output looks real good if it successfully resolves ip to hostname, but the problem comes in if it can’t resolve – my output looks crappy – like this… </readme>@nsl = `nslookup $_`; $reso = $nsl[3]; if ($? = 0) { $getit = (split (/\s+/, $reso))[1]; # pull hostname only print “$_ -> $getit\n”; } else { print “$_ - could not resolve.\n”; }
<readme> Is there a way to suppress all the ***Can’t find server name… crap out of my output and keep the output pretty? It seems pretty simple but I can’t get my hands on it. Thanks. </readme>***dc1 can’t find server name for address 9.0.1.2: Non-existent domain 1.2.3.4 -> Hostname1 5.6.7.8 -> Hostname2 9.0.1.2 -> Could not resolve. 3.4.5.6 -> Hostname7 ***dc1 can’t find server name for address 7.8.9.0: Non-existent domain 7.8.9.0 -> Could not resolve.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Suppress output from nslookup
by Necos (Friar) on May 18, 2007 at 02:47 UTC | |
|
Re: Suppress output from nslookup
by Anonymous Monk on May 18, 2007 at 04:59 UTC |