Options

show run | section

livenliven Member Posts: 918
If the

| section

option is not available

and the only options are:

append Append redirected output to URL (URLs supporting append operation only)
begin Begin with the line that matches
exclude Exclude lines that match
include Include lines that match
redirect Redirect output to URL
tee Copy output to URL

Is there a regex combo that would allow one to call groupings of lines?

For instance I am trying to look through the config of a switch that has thousands of lines of config. I would like to be able to do:


show run | i <all lines for an interface>

But the version of the IOS running on this box doesn't include the "section" regex or modifier.

Does anyone know how to hack or code that up with the commands I have available?

Thanks!
encrypt the encryption, never mind my brain hurts.

Comments

  • Options
    shednikshednik Member Posts: 2,005
    liven I think this is what you are looking for:
    testswitch#sh run interface FastEthernet 0/7
    Building configuration...
    
    Current configuration:
    !
    interface FastEthernet0/7
     duplex full
     speed 100
     switchport trunk encapsulation dot1q
     switchport trunk allowed vlan 1,5-10,12
     switchport mode trunk
    end
    
  • Options
    phantasmphantasm Member Posts: 995
    Doesn't "sh run | include int" do it?
    "No man ever steps in the same river twice, for it's not the same river and he's not the same man." -Heraclitus
  • Options
    shednikshednik Member Posts: 2,005
    phantasm wrote:
    Doesn't "sh run | include int" do it?

    Yea it would you just have to include the exact syntax so no int fa0/7 it would have to be interface FastEthernet 0/7
  • Options
    cisco_troopercisco_trooper Member Posts: 1,441 ■■■■□□□□□□
    I have only seen the section option on 7613s. Not saying that it doesn't exist otherwise...just saying that is the only place I have actually seen it in production.
  • Options
    tierstentiersten Member Posts: 4,505
    I have only seen the section option on 7613s. Not saying that it doesn't exist otherwise...just saying that is the only place I have actually seen it in production.
    Appears to be in 12.4 and above for all routers.
  • Options
    ConstantlyLearningConstantlyLearning Member Posts: 445
    tiersten wrote:
    I have only seen the section option on 7613s. Not saying that it doesn't exist otherwise...just saying that is the only place I have actually seen it in production.
    Appears to be in 12.4 and above for all routers.

    Yep, just tried it on my 2611 with 12.4 and it worked.
    "There are 3 types of people in this world, those who can count and those who can't"
  • Options
    livenliven Member Posts: 918
    I have only seen the section option on 7613s. Not saying that it doesn't exist otherwise...just saying that is the only place I have actually seen it in production.

    It exists on 6509's I know because our lab has 2 of them.
    encrypt the encryption, never mind my brain hurts.
  • Options
    livenliven Member Posts: 918
    shednik wrote:
    liven I think this is what you are looking for:
    testswitch#sh run interface FastEthernet 0/7
    Building configuration...
    
    Current configuration:
    !
    interface FastEthernet0/7
     duplex full
     speed 100
     switchport trunk encapsulation dot1q
     switchport trunk allowed vlan 1,5-10,12
     switchport mode trunk
    end
    


    Yes but I don't want just interface information, I want to be able to include any section... When I only have a little bit of information.

    I wish you could do a

    show run | i <some text> PLUS 5 lines above or 5 lines below etc....
    encrypt the encryption, never mind my brain hurts.
  • Options
    Mrock4Mrock4 Banned Posts: 2,359 ■■■■■■■■□□
    liven wrote:
    I wish you could do a

    show run | i <some text> PLUS 5 lines above or 5 lines below etc....

    Generally if I want to see say something + 5 lines below I do a "Sh run | begin router ospf" or wherever I want to start..has the same effect, but doesn't do much about at looking at the config above.
  • Options
    mj8mj4mj8mj4 Member Posts: 56 ■■□□□□□□□□
    liven wrote: »
    Yes but I don't want just interface information, I want to be able to include any section... When I only have a little bit of information.

    I wish you could do a

    show run | i <some text> PLUS 5 lines above or 5 lines below etc....


    Thanks..........
Sign In or Register to comment.