Hi there,
I am currently writing a script that will analyse the output of a cisco device.
From the device I get the output of the Show Diag command. It produces something like show below.
I put the output into an array and analyse it. Sor instance I am looking for the word "Part number" and getting the value belonging to it. The problem is that my search string might occur more that once, and I don't know how to control which one the program has....
Could anyone help me with this ? How can I control or check where it gets the value in the output ?
For instance in the example above, I first want to start at slot 0 and analyse everything that's in there. When that is finished I want to get the output of slot 1 etc etc
Finally I would also like to separate the modules that are in slot 0 and 1, so in the example above I would get
Slot 0:
module 1: Combo 2E, 2W Port adapter
Part number
module 2: Serial 1T WAN daughter card
Part number
module 3: Serial 1T WAN daughter card
Part number
...any help is greatly appreciated...
Regards from Holland.
I am currently writing a script that will analyse the output of a cisco device.
From the device I get the output of the Show Diag command. It produces something like show below.
Code:
VHN_1101_1#sh diag
Slot 0:
Combo 2E, 2W Port adapter, 4 ports
Port adapter is analyzed
Port adapter insertion time unknown
EEPROM contents at hardware discovery:
Hardware revision 1.2 Board revision A0
Serial number 8837704 Part number 800-01171-05
FRU Part Number: NM-2E2W=
Test history 0x0 RMA number 00-00-00
EEPROM format version 1
EEPROM contents (hex):
0x00: 01 1E 01 02 00 86 DA 48 50 04 93 05 00 00 00 00
0x10: 50 00 00 00 98 05 19 17 FF FF FF FF FF FF FF FF
WIC Slot 0:
Serial 1T WAN daughter card
Hardware revision 1.1 Board revision E0
Serial number 8328657 Part number 73-1775-02
Test history 0x0 RMA number 00-00-00
Connector type Wan Module
EEPROM format version 1
EEPROM contents (hex):
0x20: 01 02 01 01 00 7F 15 D1 49 06 EF 02 00 00 00 00
0x30: 70 00 00 00 98 05 22 01 FF FF FF FF FF FF FF FF
WIC Slot 1:
Serial 1T WAN daughter card
Hardware revision 1.1 Board revision E0
Serial number 8330349 Part number 73-1775-02
Test history 0x0 RMA number 00-00-00
Connector type Wan Module
EEPROM format version 1
EEPROM contents (hex):
0x20: 01 02 01 01 00 7F 1C 6D 49 06 EF 02 00 00 00 00
0x30: 70 00 00 00 98 05 26 01 FF FF FF FF FF FF FF FF
Slot 1:
NM-1FE1R2W Port adapter, 2 ports
Port adapter is analyzed
Port adapter insertion time unknown
EEPROM contents at hardware discovery:
Hardware Revision : 1.0
Top Assy. Part Number : 800-04798-01
Board Revision : E0
Deviation Number : 0-6158
Fab Version : 04
PCB Serial Number : JAB04260BCB
RMA Test History : 00
RMA Number : 0-0-0-0
RMA History : 00
EEPROM format version 4
EEPROM contents (hex):
0x00: 04 FF 40 00 D9 41 01 00 C0 46 03 20 00 12 BE 01
0x10: 42 45 30 80 00 00 18 0E 02 04 C1 8B 4A 41 42 30
0x20: 34 32 36 30 42 43 42 03 00 81 00 00 00 00 04 00
0x30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x40: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x50: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x60: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x70: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
WIC Slot 0:
DSL SAR (ADSL)
Hardware Revision : 2.3
Part Number : 73-4771-08
Board Revision : B0
Deviation Number : 1-200
Fab Version : 05
PCB Serial Number : FOC072307U6
RMA Test History : 00
RMA Number : 0-0-0-0
RMA History : 00
EEPROM format version 4
EEPROM contents (hex):
0x00: 04 FF 40 00 2E 41 02 03 82 49 12 A3 08 42 42 30
0x10: 80 00 01 00 C8 02 05 C1 8B 46 4F 43 30 37 32 33
0x20: 30 37 55 36 03 00 81 00 00 00 00 04 00 FF FF FF
0x30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x40: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x50: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x60: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x70: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
WIC Slot 1:
DSL SAR (GSHDSL/SDSL)
Hardware Revision : 1.0
Top Assy. Part Number : 800-08279-05
Board Revision : D0
Deviation Number : 0-0
Fab Version : 05
PCB Serial Number : JAD07210ANK
RMA Test History : 00
RMA Number : 0-0-0-0
RMA History : 00
EEPROM format version 4
EEPROM contents (hex):
0x00: 04 FF 40 00 35 41 01 00 C0 46 03 20 00 20 57 05
0x10: 42 44 30 80 00 00 00 00 02 05 C1 8B 4A 41 44 30
0x20: 37 32 31 30 41 4E 4B 03 00 81 00 00 00 00 04 00
0x30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x40: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x50: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x60: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x70: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
VHN_1101_1#
I put the output into an array and analyse it. Sor instance I am looking for the word "Part number" and getting the value belonging to it. The problem is that my search string might occur more that once, and I don't know how to control which one the program has....
Could anyone help me with this ? How can I control or check where it gets the value in the output ?
For instance in the example above, I first want to start at slot 0 and analyse everything that's in there. When that is finished I want to get the output of slot 1 etc etc
Finally I would also like to separate the modules that are in slot 0 and 1, so in the example above I would get
Slot 0:
module 1: Combo 2E, 2W Port adapter
Part number
module 2: Serial 1T WAN daughter card
Part number
module 3: Serial 1T WAN daughter card
Part number
...any help is greatly appreciated...
Regards from Holland.