I have a list of commands to be sent to a Juniper router. How can I sort my list by the ip address at the end of the command?
From this, generated with set_fact and with_items
"command_list": [
"show bgp neighbor 1.1.1.1",
"show bgp neighbor 2.2.2.2",
"show bgp neighbor 3.3.3.3",
"show route receive-protocol bgp 1.1.1.1",
"show route receive-protocol bgp 2.2.2.2",
"show route receive-protocol bgp 3.3.3.3",
"show route advertising-protocol bgp 1.1.1.1",
"show route advertising-protocol bgp 2.2.2.2"
"show route advertising-protocol bgp 3.3.3.3"
]
To this, ordered by the target IP.
"command_list": [
"show bgp neighbor 1.1.1.1",
"show route receive-protocol bgp 1.1.1.1",
"show route advertising-protocol bgp 1.1.1.1",
"show bgp neighbor 2.2.2.2",
"show route receive-protocol bgp 2.2.2.2",
"show route advertising-protocol bgp 2.2.2.2"
"show bgp neighbor 3.3.3.3",
"show route receive-protocol bgp 3.3.3.3",
"show route advertising-protocol bgp 3.3.3.3"
]