string subtitution

H

Henry

Hi

How can I replace certain portions of an instring?

I'm trying to resolve SNMP messages by substituting the
OID numbering with the relevant description. Example: I
would like to replace the instring with the resolved
string:
Instring= OID: 1.3.6.1 Value: ABC OID: 1.3.6.5 Value:
Critical OID: 1.3.6.7 Value: 13:05
Resolved string= Server: ABC Status: Critical Time: 13:05

Any ideas how or maybe a tool???? Any input will be
appreciated
 
T

Torgeir Bakken \(MVP\)

Henry said:
How can I replace certain portions of an instring?

I'm trying to resolve SNMP messages by substituting the
OID numbering with the relevant description. Example: I
would like to replace the instring with the resolved
string:
Instring= OID: 1.3.6.1 Value: ABC OID: 1.3.6.5 Value:
Critical OID: 1.3.6.7 Value: 13:05
Resolved string= Server: ABC Status: Critical Time: 13:05

Any ideas how or maybe a tool???? Any input will be
appreciated
Hi

@echo off
Set InString=OID: 1.3.6.1 Value: ABC OID: 1.3.6.5 Value: Critical OID: 1.3.6.7 Value: 13:05
for /f "Tokens=4" %%a in ("%InString%") do set OIDServer=%%a
for /f "Tokens=8" %%a in ("%InString%") do set OIDStatus=%%a
for /f "Tokens=12" %%a in ("%InString%") do set OIDTime=%%a
echo Server: %OIDServer% Status: %OIDStatus% Time: %OIDTime%
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top