Aug-09-2018, 02:47 PM
I have a STRING and i want to convert that into nested list.
My current script giving me below output :
Test-RED# sh run vlan 1-10 !Command: show running-config vlan 1-10 !Time: Thu Aug 9 06:00:45 2018 version 7.1(4)N1(1c) vlan configuration 1-10 vlan 1 vlan 2 name UNUSED mode vpc vlan 10 name SALES mode vpc Test-RED# Test-BLUE# sh run vlan 1-10 !Command: show running-config vlan 1-10 !Time: Thu Aug 9 06:01:37 2018 version 7.1(4)N1(1c) vlan configuration 1-10 vlan 1 vlan 2 name UNUSED mode vpc vlan 10 name HR mode vpc Test-BLUE#Expected Output :
Test-RED# = [['vlan 1'], ['vlan 2', ' name UNUSED', ' mode vpc'], ['vlan 10', ' name SALES', ' mode vpc']] Test-BLUE# = [['vlan 1'], ['vlan 2', ' name UNUSED', ' mode vpc'], ['vlan 10', ' name HR', ' mode vpc']]Basically i want to compare the the diff between Test-RED and Test-BLUE.I know how to compare the nested list but before that i need to convert that into nested list. Any idea how can i do that ?
My current script giving me below output :
[['!Command: show running-config vlan 1-10', '!Time: Thu Aug 9 06:00:45 2018'], ['vlan 10', ' name SALES', ' mode vpc']] [['!Command: show running-config vlan 1-10', '!Time: Thu Aug 9 06:01:37 2018'], ['vlan 10', ' name HR', ' mode vpc']]