Ethernet Switching
Highlighted
Ethernet Switching

repeating conditions

[ Edited ]
‎05-27-2020 06:00 AM

hi,

trying to get the only the following interfaces' configuration ..... >sh conf inter | display set | match "?"... any smart condition tips rather than repeating same FPC/PIC?

I used this type but it didn't work: >sh conf inter | display set | match "xe-0/0/[8,26,44]|ge-0/0/18|xe-1/0/15|xe-2/0/[10,11,12]|xe-3/0/[15,22,25,28]" 

xe-0/0/8, 
ge-0/0/18,
xe-0/0/26,
xe-0/0/44,
xe-1/0/15,
xe-2/0/10,
xe-2/0/11,
xe-2/0/12,
xe-3/0/15,
xe-3/0/22,
xe-3/0/25
xe-3/0/28

 

5 REPLIES 5
Highlighted
Ethernet Switching

Re: repeating conditions

‎05-27-2020 08:09 AM

Hi Arix,

 

You can use |  (pipe) keyword in the match condition to achieve this, as shown below.

 


labroot@jtac-mx960dc-r2005-re0> show configuration | display set | match "lo0 |ms-4/2/0 | xe-2/0/3 "
set interfaces xe-2/0/3 unit 0 family inet address 128.0.0.1/24
set interfaces ms-4/2/0 unit 0 family inet address 223.189.62.13/32
set interfaces ms-4/2/0 unit 1 family inet
set interfaces ms-4/2/0 unit 1 service-domain inside
set interfaces ms-4/2/0 unit 2 family inet
set interfaces ms-4/2/0 unit 2 service-domain outside
set interfaces lo0 unit 0 family inet address 3.3.3.3/32

 

 

If this solves your problem, please mark this post as "Accepted Solution" so we can help others too

 

Kudos are appreciated too 

 

Regards,

Nadeem

Ethernet Switching

Re: repeating conditions

‎05-27-2020 08:40 AM

Hello Arix,

 

I checked your example and I saw you didn't close the group of interfaces of xe-0/0/[X]

 

>show configuration interfaces | display set | match "xe-0/0/[8,26,44]|ge-0/0/18|xe-1/0/15|xe-2/0/[10,11,12]|xe-3/0/[15,22,25,28]" 

 

I tried a similar example and it worked. The only problem I found is that if for instance I use "xe-0/0/[1,2,3] I'll see the configuration of the interfaces 1, 2 and 3 and also all the rest of interfaces starting with 1, 2 and 3 (10,11.... 20,21....)

 

Is this the proble you are seeing? Based on your example you shouldn't be seeing this problem.

 

If this solves your problem, please mark this post as "Accepted Solution" so we can help others too

 

Best regards,

Highlighted
Ethernet Switching

Re: repeating conditions

‎05-27-2020 08:43 AM

Hi Arix,

 

I believe there is no easy way to accomplish this from CLI. Perhaps from shell itself you could use egrep to summarize it with something like:

 

% cli -c "show configuration interfaces | display set" | egrep "xe-0/0/[8,26,44] | ge-0/0/18 | xe-1/0/15 | xe-2/0/[10,11,12] | xe-3/0/[15,22,25,28]" 

 

Here you can use the full range of egrep with AND | OR conditions as in linux. I just tried the egrep fe-0/0/[x,y] | z" on my local SRX and it worked. 

 

Please mark "Accept as Solution" if this works for you.

Kudos are always appreciated!

 

Highlighted
Ethernet Switching

Re: repeating conditions

‎05-27-2020 04:17 PM

It is exactly what rbabraham is pointing ...

still trying to achieve that... But it is annoying thing....

Highlighted
Ethernet Switching

Re: repeating conditions

‎05-28-2020 12:56 AM

Hi Arix,

 

You can use space to get the desired output.

 

For example : 

 

show config interrfaces | display set | match "et-0/0/[1-3] "
set interfaces et-0/0/1 description test
set interfaces et-0/0/1 gigether-options 802.3ad ae110

 

 

show config interrfaces |display set | match "et-0/0/[1-3][1-4] "
set interfaces et-0/0/11 description test
set interfaces et-0/0/11 gigether-options 802.3ad ae140
set interfaces et-0/0/13 description AVAILABLE
set interfaces et-0/0/13 disable
set interfaces et-0/0/23 description AVAILABLE
set interfaces et-0/0/23 disable
set interfaces et-0/0/31 description test
set interfaces et-0/0/31 gigether-options 802.3ad ae92

 

BR,

Vishal

 

PS: Please accept my response as solution if it answers you query, kudos are appreciated too!

Feedback