Re: trap information interchange: in text format
Joao Miguel Ferreira <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Dave, I just foun the time to make some tests... about your question:
> > VARBIND_OID=".1.3.6.1.2.1.a.b.c.d.e"
> > VARBIND_TYPE="Integer"
> > VARBIND_VALUE="1000"
> > VARBIND_OID=".1.3.6.1.2.13.45.w.v.z.q"
> > VARBIND_TYPE="Srting" VARBIND_VALUE="Hello World"
>
> How would you handle string values containing a " character?
Like this:
#!/usr/bin/perl
use warnings;use strict;
my $temp;my $key;my $value;
my $line='VAL="123" STR1="abcd" STR2="abcd"xyzw"';
my @fields = split / /,$line;
foreach $temp (@fields) {
if ($temp =~ /(\S+)=\"(.+)"$/) {
print "Key $1 has Value $2\n";
};
}
It works.
This is the output
---------------------------------------
Key VAL has Value 123
Key STR1 has Value abcd
Key STR2 has Value abcd"xyzw
---------------------------------------
Perl is great.
thank you
jmf
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users