As you may have already realised I am always looking for ways to speed up my day to day tasks.
Every few days I check my BGP peering to see if there are any sessions down and then give the peers the obligatory nudge to reset a session.
Normally I run ‘ show bgp sum | i Active’ or Idle/Open which gives me a list of peers that are not in an ‘established’ state. This means running a seperate command for each Active/Idle/Open session.
Thats far too much like hard work so i started to see what other option were available after the | . One of them is utility egrep! So, after 7 mins of trying to run commands and finally realising I have to escape the | i have came up with the below:-
show bgp summary | utility egrep ‘Idle| Active| Open’
Hope it helps you save some time!
Good to see that IOS has this capability….here is an example of this from JUNOS that has had this command for something like 14 years
show interface terse | match “ge|gre”
The interesting thing is that you can also substitute the “match” command for grep as this is what is being used under the hood…