SUMMARY: OT:Perl Script

2007-12-24 23:28:00

I want to thank everyone who responed (20 responses, too may to thank
individually). Got exactly what I was looking for with the following:

$myquery="interfaces.ifTable.ifEntry.ifOutErrors.3 = 2066577";
($name, $value) = split(/ = /,$myquery);

from David Meissner. I can't believe it was that simple.

Original post:
> Sorry for the off topic post, but this has been evading me for quite some
time
> and I figure there's a good amount of shell scripting, perl guru's out
here.
>
> I've got a simple regular expression matching question I can't figure
> out.
>
> I'm using SNMP to get interface info. I'm trying to store the results
> in a database but I need to put the output in a variable.The string
> looks like this:
>
> $myquery="interfaces.ifTable.ifEntry.ifOutErrors.3 = 2066577";
>
> I want to put the value 2066577 into a variable. How would I go about
> getting that value into $value for example in terms of $myquery?
>
> If someone has a suggestion in either perl(preferable) or sh I would be
> appreciative.
> Thanks

Comments

Got something to say?

You must be logged in to post a comment.