in reply to Samba, Linux, Winbind, UTMP, usernames and IP addresses

Sometimes I make things much more difficult on my self than it needs to be. With proper use of the nmblookup command this is simple parsing!
#!/usr/bin/perl -w # Script to deliver the IP address or get name based on WINS data use strict; my $command = "nmblookup \'$ARGV[0]\#03\'"; my @contents = `$command`; while (<@contents>) { if ($_ =~ /\d+\.\d+\.\d+\.\d+/) { m/(\d+\.\d+\.\d+\.\d+)/; print $1 unless ($1 eq '10.0.255.255'); } }