Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

egrep alternative for "section" on ASR 9000

Hi

One of the commands that was very handy on the Catalyst was the "section" command. But this isn't available on the ASR9K. Apparently there is a way of doing this with egrep that someone showed me on a course, but I've forgotten and I can't get hold of the person anymore. It might help if I explain what I am trying to achieve.

We have route-policy being used in a neighbor-group. If I want to search which neighbor-group is using the policy, I'd would use something like:

show run | sec myroutepolicy

I'll post if I think of other examples.

At the very least, being able to find a few lines before or after the searched string would be great.

Thanks in advance

Everyone's tags (6)
1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

egrep alternative for "section" on ASR 9000

Hi Mahomed,

I'm not much sure about the egrep to filter based on section.  But if your need is to find which neighbor-group a policy is attached to, there is a much simpler way.  Look for the attach point.

eg;

#sh rpl route-policy V4-ADVERTISE-DEFAULT-ONLY attachpoints

BGP Attachpoint: Neighbor

Neighbor/Group                           type  afi/safi   in/out     vrf name bound by 

--------------------------------------------------------------------------------

TIER4-IPv4-CMTS                     nbr  IPv4/uni   out        default    V4-ADVERTI

This would tell you, to which all attach-points (neighbor-group) its mapped.

Regards,

Sudeep

10 REPLIES
Cisco Employee

egrep alternative for "section" on ASR 9000

Hi Mahomed,

I'm not much sure about the egrep to filter based on section.  But if your need is to find which neighbor-group a policy is attached to, there is a much simpler way.  Look for the attach point.

eg;

#sh rpl route-policy V4-ADVERTISE-DEFAULT-ONLY attachpoints

BGP Attachpoint: Neighbor

Neighbor/Group                           type  afi/safi   in/out     vrf name bound by 

--------------------------------------------------------------------------------

TIER4-IPv4-CMTS                     nbr  IPv4/uni   out        default    V4-ADVERTI

This would tell you, to which all attach-points (neighbor-group) its mapped.

Regards,

Sudeep

Cisco Employee

egrep alternative for "section" on ASR 9000

Hi Mahomed

Another way too find this information (in addition to the good info from Sudeep) si to look at BGP. In this example ISP-V4-PEER is my neighbor group, and this shows which neighbors are using it:

RP/0/RSP1/CPU0:asr9k#show bgp neighbor-group  ISP-V4-PEER ?

  configuration  Show the effective configuration

  inheritance    Show the groups this neighbor/group can inherit config from

  users          Show the neighbors/groups that can inherit config from this group

RP/0/RSP1/CPU0:asr9k#show bgp neighbor-group  ISP-V4-PEER users

Session:      10.0.128.73  10.0.128.71  10.0.128.69

IPv4 Unicast: 10.0.128.73  10.0.128.71  10.0.128.69

Regarding the IOS | section, we don't need the "section" in XR, just do:

show run router bgp

or

show run router bgp neighbor

etc,etc

With XR each config section stanza can be looked at without the need for "| section"

regards,

david

New Member

egrep alternative for "section" on ASR 9000

Thanks Sudeep, that's exactly what I needed to fix the immediate problem. I still would've liked to know how to view a "section" or at least lines before and after a result using egrep.

David, thanks for the info. In this case your exact command didn't help, but Sudeep's did. I completely understand about the ASR providing commands to view parts of the config or return specific info about the config (like Sudeep's example). Now don't get me wrong, I love the flexibility and the useful information that is returned. But I have a few problems with this approach:

  1. You have to know the exact command or section to check in order to get the info. This isn't always the case. Case in point is my question
  2. You may not always know where in the config a specific bit of information is, and the section command helped in most cases.

But the info returned is great so I'll try to learn more of the commands. Thanks for your help.

Cisco Employee

egrep alternative for "section" on ASR 9000

Interesting you bring that up, I recently got this question a few times in the past few weeks, I have a functionality enhancement open for this. Follow CSCuj69066

the egrep you are asking about is show run | include Interface | utility egrep -C 3 (to get 3 surrounding lines)

but that is not working (anymore) in XR due to the egrep version it has in the qnx...

xander

Xander Thuijs CCIE #6775 Principal Engineer ASR9000, CRS, NCS6000 & IOS-XR
New Member

egrep alternative for "section" on ASR 9000

Hi Alexander

I KNEW it was possilbe! But yes, you are right that option doesn't seem to be working anymore in 4.3. I'm glad it wasn't just me going mad. It's a pity we can't "vote" on the bug so Cisco can see how many people want it fixed or are affected.

I actually found another reason to use such a command. I searched my config for 499. I thehn get a result like this:

[code]

Thu Oct 10 10:46:07.237 BST

Building configuration...

source Bundle-Ether121.499

[code]

But now how would I find the exact bit of config? This is where the "section" or even better, the egrep command would be useful.

Cisco Employee

egrep alternative for "section" on ASR 9000

Hi Mahomed,

yup that is the usecase I have for it also. The bug voting is a nice one, let me see if we can do something with that.

It may not change overnight, but definitely something worth exploring.

regards!

xander

Xander Thuijs CCIE #6775 Principal Engineer ASR9000, CRS, NCS6000 & IOS-XR
Cisco Employee

egrep alternative for "section" on ASR 9000

Mohamed,

Another useful way to find the section of the config where certain lines are configured or also how many places something is under.  For example:

RP/0/RSP1/CPU0:ASR9006-E#sh run formal | in 0/1/0/15

Thu Oct 10 19:54:49.290 UTC

Building configuration...

interface TenGigE0/1/0/15 cdp

interface TenGigE0/1/0/15 ipv4 address 22.22.22.21 255.255.255.0

interface TenGigE0/1/0/15 shutdown

router ospf 1 area 0 interface TenGigE0/1/0/15

mpls ldp interface TenGigE0/1/0/15

RP/0/RSP1/CPU0:ASR9006-E#

Here you can see that tengig 0/1/0/15 is configured under OSPF and MPLS LDP. 

Bryan

New Member

egrep alternative for "section" on ASR 9000

Hi Bryan

I almost missed the fact that the bit you were highlighting in that command was the formal keyword But after reading it a couple of times I understood (No coffee yet).

I have tested it with my search and it has indeed highlighted the correct section of the config that I would need. I'm definitely going to remember that keyword and use it more often in my searches Thanks again.

New Member

Hi Xander,- I'm missing

Hi Xander,

- I'm missing exactly the same functionality with egrep (-A, -B,..). It's not just about config, it would be very helpful with various sh commands.  

Any news on that in the meantime?

thx

thomas 

 

New Member

Still not working in 5.2.0

Still not working in 5.2.0 either :( What do we have to do to get this bug noticed?

1170
Views
3
Helpful
10
Replies