#!/usr/bin/perl -w # sip - Samba IP lookup derived from nmblookup output. # Queries for names available to Samba but not DNS. use strict; use Getopt::Std; use vars qw($opt_n $opt_i); getopts('ni:'); if (! @ARGV){ print usage(); die "\n"; } my (undef,@hosts) = split (/\n/, `nmblookup $ARGV[0]`); $opt_i ||= ""; for (@hosts){ s/\S+$|\s//g; m/^$opt_i/ and print $_.($opt_n?"\n":""); } sub usage { my ($prog) = $0 =~ m!([^/]+)$!; return <] [-n] : nmblookup the host to retrieve the numerical ip. Ex: \tping \$($prog host) \tscp ($ENV{'USER'}\@\$($prog linuxhost):.profile ./ \tlynx http://\$($prog pwshost)/cgi-bin/env.pl -n Print newline after output. Ex: \t$prog -n host -i Choose one of multiple network interfaces listening for nmb. Pattern-match is from left to right. \t$prog -ni 192. host HERE } __END__ ~