in reply to Re^5: His strangeness regex
in thread His strangeness regex

To make it short:

$ > snmpwalk omServer1 .1.3.6.1.2.1.1.1 system.sysDescr.0 : DISPLAY STRING- (ascii): Sun SNMP Agent, Ultra-80 $ > snmpwalk omServer2 .1.3.6.1.2.1.1.1 system.sysDescr.0 : DISPLAY STRING- (ascii): IBM PowerPC CHRP Compute +r Machine Type: 0x0800004c Processor id: 00C9FC8A4C00 Base Operating System Runtime AIX version: 05.03.0000.0060 TCP/IP Client Support version: 05.03.0000.0063 $ > snmpwalk omServer3 .1.3.6.1.2.1.1.1 snmpwalk: No response arrived before timeout.

That's the output to be processed

Replies are listed 'Best First'.
Re^7: His strangeness regex
by Anonymous Monk on Sep 04, 2009 at 11:00 UTC
    $prefixSnmpWalk will match snmpwalk: No response arrived before timeout., just like it did in my program.

      fine. I expexted this to. But it didn't match. It matched only in the version:

      s/$prefixSysDescr|$prefixSnmpWalk// && do { $OutputLine = $_; last; };

      And that is the strangeness I'm speaking of

        fine. I expexted this to. But it didn't match. It matched only in the version: .... And that is the strangeness I'm speaking of

        Unproven. Please prove it, like this

        # some declarations in the beginnings my $TAB = "\t"; my $SPACE = " "; my $oidNbrSysDescr = ".1.3.6.1.2.1.1.1"; my $prefixSysDescr = quotemeta 'system.sysDescr.0 : DISPLAY S +TRING- (ascii): '; my $prefixSnmpWalk = 'snmpwalk:\s*'; # no use ?? my $sysDescr = q~ snmpwalk: No response arrived before timeout. ~; for ( $sysDescr ) { /$prefixSysDescr/ && do { s/$prefixSysDescr/$hostName$TAB/; $OutputLine = $_; last; }; # substitute some prefixes (this one works) # /snmpwalk:\s*/ /$prefixSnmpWalk/ && do { s/snmpwalk:\s*/$hostName$TAB/; $OutputLine = $_; last; }; # error messages starting with "snmpwalk: " # here is the problem. All of a sudden I coudln't # use $prefixSnmpWalk anymore. Even quotemeta # failed $OutputLine = $OutputLine . $SPACE . $_; } # process output die "$OutputLine "; __END__ No response arrived before timeout. at - line 36.