I had a customer who had many contexts running on a Cisco ACE module, and several resource-classes. She was getting frustrated at trying to to find which contexts had been allocated a particular resource-class – say resource-class XXX.
The problem was that a show context gave about 20 pages of output, and she had to sift through them to find all the XXX resources classes.
And a show context | include XXX would show the all the resource classes, but not the context – as in:
show context | include XXX Resource-class: XXX Resource-class: XXX Resource-class: XXX ...etc
show context | include XXX prev 3 was an improvement, but not ideal:
Name: Context20 , Id: 20 Config count: 25 Description: Resource-class: XXX -- Name: Context27 , Id: 27 Config count: 15 Description: Resource-class: XXX ...etc
So to get the desired result, I passed this through another filter:
show context | include XXX prev 3 | include Name:
show context | include XXX prev 3 | include Name: Name: Context20 , Id: 20 Name: Context27 , Id: 27 Name: Context37 , Id: 37 Name: Context39 , Id: 39 ...etc
Success! But still not satisfied, because the output doesn’t actually show the “XXX”, and if I were wanting to send to a text file, syslog or something, it might be nice to see that extra detail
Back to the drawing board – and
show context | include XXX prev 3 | exclude count: | exclude Description:
show context | include XXX prev 3 | exclude count: | exclude Description: Name: Context20 , Id: 20 Resource-class: XXX -- Name: Context27 , Id: 27 Resource-class: XXX -- Name: Context37 , Id: 37 Resource-class: XXX -- Name: Context39 , Id: 39 Resource-class: XXX ...etc
Oh what fun!
I found some more cool stuff you can do with Cisco Router parsing here:
http://www.networkworld.com/community/node/60829