fork download
  1. s = """switch_168#sh cdp neighbors detail
  2. -------------------------
  3. Device ID: SW-PRITHVI-SRG-MM26
  4. Entry address(es):
  5. IP address: 10.104.105.115
  6. Platform: cisco WS-C2960-48PST-L, Capabilities: Switch IGMP
  7. Interface: GigabitEthernet1/0/15, Port ID (outgoing port): FastEthernet0/32
  8. Holdtime : 126 sec
  9.  
  10. Version :
  11. Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE4, RELEASE SOFTWARE (fc1)
  12. Technical Support: http://w...content-available-to-author-only...o.com/techsupport
  13. Copyright (c) 1986-2010 by Cisco Systems, Inc.
  14. Compiled Fri 26-Mar-10 09:14 by prod_rel_team
  15.  
  16. advertisement version: 2
  17. Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF00000000000040F4EC800F80FF0000
  18. VTP Management Domain: 'RDP'
  19. Native VLAN: 804
  20. Duplex: full
  21. Management address(es):
  22. IP address: 10.104.105.115
  23.  
  24. -------------------------
  25. Device ID: SW-PRITHVI-SRG-MM28
  26. Entry address(es):
  27. Platform: cisco WS-C3560G-48PS, Capabilities: Switch IGMP
  28. Interface: GigabitEthernet1/0/35, Port ID (outgoing port): GigabitEthernet0/31
  29. Holdtime : 124 sec
  30.  
  31. Version :
  32. Cisco IOS Software, C3560 Software (C3560-IPBASE-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1)
  33. Technical Support: http://w...content-available-to-author-only...o.com/techsupport
  34. Copyright (c) 1986-2010 by Cisco Systems, Inc.
  35. Compiled Tue 28-Sep-10 13:21 by prod_rel_team
  36.  
  37. advertisement version: 2
  38. Protocol Hello: OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF00000000000058BFEA234E00FF0000
  39. VTP Management Domain: ''
  40. Native VLAN: 1
  41. Duplex: full
  42.  
  43. -------------------------
  44. Device ID: SEP08D09F9FC91F
  45. Entry address(es):
  46. IP address: 192.168.1.3
  47. Platform: Cisco IP Phone 9971, Capabilities: Host Phone Two-port Mac Relay
  48. Interface: GigabitEthernet1/0/41, Port ID (outgoing port): Port 1
  49. Holdtime : 168 sec
  50. Second Port Status: Down
  51.  
  52. Version :
  53. sip9971.9-4-2SR2-2
  54.  
  55. advertisement version: 2
  56. Duplex: full
  57. Power drawn: 14.389 Watts
  58. Power request id: 8144, Power management id: 10
  59. Power request levels are:14389 0 0 0 0
  60. Spare Pair PoE: Yes, Spare Pair Detection Required: No
  61. Spare Pair PD Config: Enable, Spare Pair PSE Operational: No
  62.  
  63.  
  64. Total cdp entries displayed : 3"""
  65.  
  66. r = s.split("Device ID")
  67. x = r[1]
  68. z = x.split("IP address:",1)
  69. print z
Success #stdin #stdout 0.01s 7264KB
stdin
Standard input is empty
stdout
[': SW-PRITHVI-SRG-MM26\nEntry address(es):\n  ', " 10.104.105.115\nPlatform: cisco WS-C2960-48PST-L,  Capabilities: Switch IGMP\nInterface: GigabitEthernet1/0/15,  Port ID (outgoing port): FastEthernet0/32\nHoldtime : 126 sec\n\nVersion :\nCisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE4, RELEASE SOFTWARE (fc1)\nTechnical Support: http://w...content-available-to-author-only...o.com/techsupport\nCopyright (c) 1986-2010 by Cisco Systems, Inc.\nCompiled Fri 26-Mar-10 09:14 by prod_rel_team\n\nadvertisement version: 2\nProtocol Hello:  OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF00000000000040F4EC800F80FF0000\nVTP Management Domain: 'RDP'\nNative VLAN: 804\nDuplex: full\nManagement address(es):\n  IP address: 10.104.105.115\n\n-------------------------\n"]