Junos
Junos

Regular Expression Help Required Please

‎10-14-2019 01:44 AM

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

 

 

Ajaz Nawaz
JNCIE-SEC#254 CCIE#15721
JNCIA-FWV | JNCIS-FWV
JNCIA-JUNOS | JNCIS-SEC
JNCIP-SEC | JNCIE-SEC
CCNP-Collaboration
8 REPLIES 8
Junos

Re: Regular Expression Help Required Please

‎10-14-2019 01:52 AM

Hi, 

 

You could try: 

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

Cheers,

Ashvin

Junos

Re: Regular Expression Help Required Please

‎10-14-2019 02:15 AM

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

Ajaz Nawaz
JNCIE-SEC#254 CCIE#15721
JNCIA-FWV | JNCIS-FWV
JNCIA-JUNOS | JNCIS-SEC
JNCIP-SEC | JNCIE-SEC
CCNP-Collaboration
Junos

Re: Regular Expression Help Required Please

‎10-14-2019 02:25 AM

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

Junos

Re: Regular Expression Help Required Please

‎10-14-2019 02:25 AM

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

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

Junos

Re: Regular Expression Help Required Please

‎10-14-2019 02:31 AM

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

Junos

Re: Regular Expression Help Required Please

[ Edited ]
‎10-14-2019 03:22 AM

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 

 

 

Ajaz Nawaz
JNCIE-SEC#254 CCIE#15721
JNCIA-FWV | JNCIS-FWV
JNCIA-JUNOS | JNCIS-SEC
JNCIP-SEC | JNCIE-SEC
CCNP-Collaboration
Junos
Solution
Accepted by topic author anawaz
‎10-17-2019 02:42 AM

Re: Regular Expression Help Required Please

‎10-14-2019 06:40 AM

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

Junos

Re: Regular Expression Help Required Please

[ Edited ]
‎10-17-2019 02:41 AM

Also works Sharat !

 

:-)

 

Ajaz Nawaz
JNCIE-SEC#254 CCIE#15721
JNCIA-FWV | JNCIS-FWV
JNCIA-JUNOS | JNCIS-SEC
JNCIP-SEC | JNCIE-SEC
CCNP-Collaboration