Hello all,

here I go again with another reegex problem. I have the following in a
conf file:

%CardType%              .1.3.6.1.4.1.45.1.6.3.3.1.1.5
%CardSlotNum%           =calc=CardType/3.([0-9]*).0/ 

Now what I'm wanting to do is get the card type (using SNMP). Then to
calculate the slot number, I want to take the output from cardtype (e.g.
1.3.6.1.4.6.23.1.1.3.1.0), and apply the regex /3.([0-9]*).0/ to it and
use $1; in the above example $1 = 1.

So here is my code thus far, but I'm afraid it does not work.
if ( /^%([a-zA-Z]*)%[\s\t]*[\=calc\=([a-zA-Z]+)\/(.*)\/|(\.[0-9]*)]/ ) {
               $oid = lc($1);
               $value = $2; #the OID of for this device
               print ( "\$1 is : <" . $oid . ">\t\$2 is :" . $value .
"\$3 = " . $3 . "\n" ) if $parse_debug;
               $oid =~ s/ //g;
       } else {
            die ("Config file is badly built");
       }

Perhaps the guru regex people can give me a clew as to how to write it
so that it does work.

Thanks in advance.
H

-- 
This message contains confidential information intended only for the use
of the addressee named above. If you are not the intended recipient of
this message, you are hereby notified that you must not disseminate,
copy or take any action in reliance on it. If you have received this
message in error, please delete it. Any views expressed in this message
are those of the individual sender, except where the sender specifically
states them to be the view of QED Technologies. We aim to provide the
highest degree of security for our customers. Where necessary, all
messages are encrypted, all servers are secured and will henceforth
remain so. If this is an inconvenience to you, we are sorry, but our
business is at stake; a risk we consider no worth taking.
~~
Hamish Whittal          QED Technologies                Tel: +27 21 448 9291
[EMAIL PROTECTED]                                      Fax: +27 21 448 9551
                        `The' Linux Services Company    Cel: +27 82 803 5533

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

Reply via email to