Should be simple, but...

I'm trying to find the quickest command to trim the sho int b output on a Nexus 7000.

The output of the sho int b is as follows:

Eth1/3        --     eth  routed down    SFP not inserted           auto(S) --
Eth1/4        --     eth  routed down    Administratively down      auto(S) --
Eth1/5        --     eth  routed down    Administratively down      auto(S) --
Eth1/6        --     eth  routed down    Administratively down      auto(S)
Eth1/7        --     eth  routed down    SFP not inserted           auto(S) --
Eth1/8        --     eth  routed down    Administratively down      auto(S) --
Eth1/9        1      eth  trunk  up      none                        10G(D) 1

If I only wanted to see this ouput for port Eth1/5-1/9, how would I do it?  Or is it even possible?

Whether I type any of the following I get no output:

sho int b | in Eth1/5_Eth1/6_Eth1/7_Eth1/8_Eth1/9 

or

sho int b | in Ethernet1/5_Ethernet1/6_Ethernet1/7_Ethernet1/8_Ethernet1/9

or

sho int b | in Eth1/5,Eth1/6,Eth1/7,Eth1/8,Eth1/9

or

sho int b | in Ethernet1/5,Ethernet1/6,Ethernet1/7,Ethernet1/8,Ethernet1/9

Any suggestions?

Comments

  • Hey pal!

    The show commands with the "inc" statement can be used with regular expressions!

    http://packetattack.org/2010/05/10/rocking-your-show-commands-with-regex/

    You can connect the include statements with 1/1 AND 1/2 AND 1/3. I am in a hurry at the moment so I dont have time to lookup the right operator symbol for an AND but I think thatll help you.

    Please tell me if it worked! Regards!

  • If I only wanted to see this ouput for port Eth1/5-1/9, how would I do it?  Or is it even possible?

    You could try show int b | in Eth1/(5|6|7|8|9)_

    There would be quicker way but the regex engine used by Cisco is not so great e.g I can't use show int b | in Eth1/(5-9)_

    HTH

  • This one gives the same respones as they ones I tired earlier.  Looks like it completes but no output.

  • Not exactly what I was looking for but the following worked !!!

    sho interf status | i Eth1/(2[5-8])

    Shows only ports Ethernet1/25-28

    Thanks

    I've now bookmarked this page.

  • Not exactly what I was looking for but the following worked !!!

    sho interf status | i Eth1/(2[5-8])

    Shows only ports Ethernet1/25-28

    Ah! That's my bad - trying to do a range of values with normal brackets instead of square.

    The following should work then - sho interf status | i Eth1/[5-9] or sho interf status | i Eth1/[5-9]_

    HTH

     

  • You should always escape the forward slash when doing regex. Try the following regex:

    sh int b | i Eth1/[5-9]_

  • You should always escape the forward slash when doing regex. Try the following regex:

    sh int b | i Eth1/[5-9]_

    I tried without excape it works fine.  However if you wanted to match a "" then this would need to be escaped.

    Take a look at the following link http://www.regular-expressions.info/characters.html

  • True.

    Just a habit I have of escaping special characters.

  • Is the a capital "V" ?


  • No this was a "" followed by "/" on the assumption that "/" is a special character in Regular expressions. Which I don't think it is!

    However you are a familiar with Perl then "/" is used the default character used to identify the start and and end of string when performing regex manipulation.





    From: [email protected] <[email protected]>

    To: Patrick Barnes

    Sent: Fri Jan 13 16:31:50 2012
    Subject: Re: [CCIE SP] Should be simple, but...


    Is the a capital "V" ?




    INE - The Industry Leader in CCIE Preparation

    http://www.INE.com



    Subscription information may be found at:

    http://www.ieoc.com/forums/ForumSubscriptions.aspx



    ******************************************************************************************

    The contents of this email and any attachments are confidential and intended

    solely for the use of the individual to whom it is addressed. If you are not the

    intended recipient, be advised that you have received this email in error and

    that any use, dissemination, forwarding, printing, or copying of this email

    is strictly prohibited. If you have received this email in error please contact the

    sender. Any views or opinions presented are solely those of the author and

    do not necessarily represent those of the company.



    Every effort has been made to ensure that this e-mail or any attachments are

    free from viruses.



    While the company has taken every reasonable precaution to minimise this

    risk, neither company, nor the sender can accept liability for any damage

    which you sustain as a result of viruses. It is recommended that you should

    carry out your own virus checks before opening any attachments.



    Registered in England. No. 3934288 - Azzurri House,

    Walsall Business Park, Walsall Road, Aldridge,WS9 0RB.

    ******************************************************************************************
Sign In or Register to comment.