Required Shell script for My requirement

Hi All,

I joined today in this forum to have all of your help.

I have a Big requirement, pls. help me to resolve.

I'm using HP-UX 11.23. I need a shell script for the following requirement.

I have a file (nodes.txt) that contains 1000 nodes.

I'm running the following command:
/opt/OV/bin/ovet_topodump.ovpl -nodeif <node name> -detail

(Pls. note <node name> field should take nodenames from the nodes.txt, this field should be replaced by next node name once the command completed for the first node)

Here is the result for one node result:
#/opt/OV/bin/ovet_topodump.ovpl -nodeif dall00r1.mis.amat.com -detail
++++++++++++++++Node+++++++++++++++++++++
NodeName: dall00r1.mis.amat.com
IPProtocolSupported: IPv4
ObjID: 004e510a-0d92-71dd-1512-9887a1f10000
OADId: 0
SysOID: 1.3.6.1.4.1.9.1.544
SysContact:
SysLocation:
Description: Cisco IOS Software, 3800 Software (C3845-ADVIPSERVICESK9-M), Versio
n 12.4(11)T2, RELEASE SOFTWARE (fc4)
Technical Support: Cisco - Shortcut
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Tue 01-May-07 00:55 by prod_rel_team
Status: Minor
Capability: isLanSwitch isIPv4Router isCDP isBGP isMulticast isSnmpSupported
++++++++++++++++Management Address+++++++++++++++++++++
AddressType: IPv4
ObjID: 004ee4e4-0d92-71dd-1512-9887a1f10000
Address: 152.135.0.61
PingState: Ping Responding
----------------Management Address---------------------
++++++++++++++++Interface+++++++++++++++++++++
IFName: dall00r1.mis.amat.com[ 0 [ 2 ] ]
ObjID: 0155c646-0d92-71dd-1512-9887a1f10000
IFAlias: -
IFDescription: GigabitEthernet0/0
Status: Normal
IfIndex: 2
IfType: 6
AggregatedInterfaceObjID: -
Capability: isL2Connected isCDP
----------------Interface---------------------
++++++++++++++++Interface+++++++++++++++++++++
IFName: dall00r1.mis.amat.com[ 0 [ 1 ] ]
ObjID: 0bb25a50-0d92-71dd-1512-9887a1f10000
IFAlias: Dest:AT&T MPLS CLOUD Type: ISP T1 CID:
IFDescription: Serial0/1/0
Status: Normal
IfIndex: 1
IfType: 23
AggregatedInterfaceObjID: -
Capability: isCDP isMulticast
++++++++++++++++Address+++++++++++++++++++++

My Requirement: Output should be....

  1. Node name should be placed in First column.
  2. Should have extra four columns (ObjID, Address, IFDescription, Status) and collect the same info from the command result.
    (Now total column is 5)

Conditions:

  1. ObjID is unique. If the ObjID does not have Adress that column should be balnk. The same way, if IFDescription, Status not available that columns should be blank.
  2. Once first ObjID completed then next ObjID should be written in next row and do the same operation.

Result should be like follow:

NodeName ObjID Addresss IFDescription Status
dall00r1... 004e510a-...
004ee4e4-... 152.135.0.61
0155c646-... GigabitEthernet0/0 Normal
0bb25a50-... Serial0/1/0 Normal

(I marked ... because the information is long)

Once it finish for one node then it pass to next node in loop which is there in nodes.txt.

I know it's pretty much work needed. Pls. help me to get this script....

Thanks,
Gobinathan.S

Try this, if it helps you.

cntr=0
while [ $cntr -lt 1000 ]
do
-- -- # Write your code
cntr=`expr $cntr + 1
done

I have attached the document which represents clear Output what I required.

Please reconsider my requirement:

Here is simplest requirement from me now.

I have below output in Text file:
++++++++++++++++Node+++++++++++++++++++++
NodeName: dall00r1.mis.amat.com
IPProtocolSupported: IPv4
ObjID: 004e510a-0d92-71dd-1512-9887a1f10000
OADId: 0
SysOID: 1.3.6.1.4.1.9.1.544
SysContact:
SysLocation:
Description: Cisco IOS Software, 3800 Software (C3845-ADVIPSERVICESK9-M), Versio
n 12.4(11)T2, RELEASE SOFTWARE (fc4)
Technical Support: Cisco - Shortcut
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Tue 01-May-07 00:55 by prod_rel_team
Status: Minor
Capability: isLanSwitch isIPv4Router isCDP isBGP isMulticast isSnmpSupported
++++++++++++++++Management Address+++++++++++++++++++++
AddressType: IPv4
ObjID: 004ee4e4-0d92-71dd-1512-9887a1f10000
Address: 152.135.0.61
PingState: Ping Responding
----------------Management Address---------------------
++++++++++++++++Interface+++++++++++++++++++++
IFName: dall00r1.mis.amat.com[ 0 [ 2 ] ]
ObjID: 0155c646-0d92-71dd-1512-9887a1f10000
IFAlias: -
IFDescription: GigabitEthernet0/0
Status: Normal
IfIndex: 2
IfType: 6
AggregatedInterfaceObjID: -
Capability: isL2Connected isCDP
----------------Interface---------------------
++++++++++++++++Interface+++++++++++++++++++++
IFName: dall00r1.mis.amat.com[ 0 [ 1 ] ]
ObjID: 0bb25a50-0d92-71dd-1512-9887a1f10000
IFAlias: Dest:AT&T MPLS CLOUD Type: ISP T1 CID:
IFDescription: Serial0/1/0
Status: Normal
IfIndex: 1
IfType: 23
AggregatedInterfaceObjID: -
Capability: isCDP isMulticast
++++++++++++++++Address+++++++++++++++++++++

I want to collect some information into columns. (Pls. check the Update attachment)

Only condition is, it should collect the information for ObjID, IFDescription, Status that follows the IF Name. In above example I have Two IFName, so I need two row of output. I don't want second objId that is residing on the same IFName.

Thanks,
Gobinathan.S