Junos OS

Expand all | Collapse all

Regular Expression Help Required Please

Jump to Best Answer
  • 1.  Regular Expression Help Required Please

    Posted 10-14-2019 01:45

    Hi all

    I would like to issue the show interface description cmd on multi-member EX VC stack, but display only ge-*/0/44-47

    Thanks in advance for your help !

    Kind regards

     

     



  • 2.  RE: Regular Expression Help Required Please

     
    Posted 10-14-2019 01:53

    Hi, 

     

    You could try: 

    show interfaces description ge-*/0/[44-47]

    Cheers,

    Ashvin



  • 3.  RE: Regular Expression Help Required Please

    Posted 10-14-2019 02:16

    Hi Ashvin

    Thanks for your suggestion, but sadly this doens't seem to work for me...

    Can I please ask if this works for you, have you tested?.

    Thanks



  • 4.  RE: Regular Expression Help Required Please

     
    Posted 10-14-2019 02:25

    Hi, 

     

    Yes, similar works for me on an MX:

    show interfaces descriptions et-*/0/[2-5]
    Interface       Admin Link Description
    et-3/0/2        up    up   *** MASKED ***
    et-3/0/5        up    up   *** MASKED ***
    et-4/0/2        up    up   *** MASKED ***
    et-4/0/5        up    up   *** MASKED ***
    et-5/0/2        up    up   *** MASKED ***
    et-5/0/5        up    up   *** MASKED ***
    et-8/0/2        up    up   *** MASKED ***
    et-8/0/5        up    up   *** MASKED ***
    et-9/0/2        up    up   *** MASKED ***
    et-9/0/5        up    up   *** MASKED ***
    et-10/0/2       up    up   *** MASKED ***
    et-10/0/5       up    up   *** MASKED ***

    Cheers, 
    Ashvin



  • 5.  RE: Regular Expression Help Required Please

     
    Posted 10-14-2019 02:26

    Hello,

     

    Can you please try if this command does the trick?

    show interfaces description ge-*/0/4[4-7]

     There is a difference:

    user@mx> show interfaces xe-*/0/[10-12] terse 
    Interface               Admin Link Proto    Local                 Remote
    xe-2/0/0                up    up 
    xe-2/0/1                up    up
    xe-2/0/2                up    down
    
    user@mx> show interfaces xe-*/0/1[0-2] terse
    Interface               Admin Link Proto    Local                 Remote
    xe-2/0/10               up    down
    xe-2/0/11               up    down
    xe-2/0/12               up    down

    Best regards,

    Sergii

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

    Please accept the solution if your problem is resolved Smiley Happy

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



  • 6.  RE: Regular Expression Help Required Please

     
    Posted 10-14-2019 02:32

    Hi, 

     

    Yes, apologies, should have been:

    show interfaces description ge-*/0/4[4-7]

    numbers are interpreted between [0-9] in squared brackets.

    Thanks Sergii for pointing out.

     

    Cheers,

    Ashvin



  • 7.  RE: Regular Expression Help Required Please

    Posted 10-14-2019 03:22

    hmm...

     

    That's strange, the asterisk doesn't seem to work for me, however, it does when i replace it with [0-5] representing the number of members in the VC stack.

     

    e.g.

     

    show interface description | match ge-[0-5]/0/4[4-7]

     

    thank you Ashvin | Sergii 

     

     



  • 8.  RE: Regular Expression Help Required Please
    Best Answer

    Posted 10-14-2019 06:41

    Hi Ajaz, 

     

    I think you should use a . character before the asterisk for the command to work.

    Example: show interface description | match ge-.*/0/4[4-7]

    As the . would be a single character and * indicates 0 or more times.

     

    Please mark "accept as solution" if this answers your query. Kudos are appreciated too ! Smiley Happy

     

    Regards,

    Sharat Ainapur



  • 9.  RE: Regular Expression Help Required Please

    Posted 10-17-2019 02:41

    Also works Sharat !

     

    🙂