"Dittrich G . Michael" wrote:
> 
> I'm trying to write a script for SNMP and stuck on following problem:
> CommandLine: snmpget -m PowerNet-Mib APC-Smart-UPS public 
>.iso.3.6.1.4.1.318.1.1.1.4.1.1.0
> (getting the batteryStatus)
> This is the response:
> .iso.3.6.1.4.1.318.1.1.1.4.1.1.0 = 2
> now I'm trying to chop the string, but all what I get back is "0".
> maybe the "=" is confusing chop, so I'm trying snmget -q -m [snip]
> i get back: .iso.3[snip].1.0 2
> still the same issue with chop.
> What I try to get is clearly the stuff after ".iso.3[snip].1.0 " (space including)


$ perl -le'
my $response = q(.iso.3.6.1.4.1.318.1.1.1.4.1.1.0 = 2);
my ( $last_digit ) = $response =~ /.*(\d+)/;
print $last_digit;
'
2


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to