I have file with this output, and I am trying to collect useful data from my file.
R1#show ip route 192.168.5.130
Routing Descriptor Blocks:
* 192.168.5.128, from 192.168.5.162, 00:20:16 ago, via Serial0/0/0.2
Route metric is 2172416, traffic share count is 1
Total delay is 20100 microseconds, minimum bandwidth is 1544 Kbit/sec
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
I want to grep match if my above paragraph have word "metric" then it should display the whole paragraph not just that line.
Also is there a way I can check condition that if metric==2172416 then return the whole paragraph.
I would like to know the simplest and easiest way to do it, since I am going to apply that in different scenarios.
Also If I have this in my file, how can fetch just the lines from Apr 11? Can I use wildcard here?
CPU0:Apr 11 05:22:04.768 UTC: pim[1182]: %ROUTING-IPV4_PIM-5-INTCHG :
CPU0:Apr 11 05:22:04.769 UTC: pim[1182]: %ROUTING-IPV4_PIM-5-NBRCHG :
CPU0:Apr 11 05:22:04.769 UTC: pim[1182]: %ROUTING-IPV4_PIM-5-NBRCHG :
CPU0:Apr 11 06:09:53.066 UTC: pim[1182]: %ROUTING-IPV4_PIM-5-INTCHG :
CPU0:Apr 11 06:09:53.066 UTC: pim[1182]: %ROUTING-IPV4_PIM-5-NBRCHG :
CPU0:Apr 11 06:09:56.707 UTC: pim[1182]: %ROUTING-IPV4_PIM-5-NBRCHG :