Day One Tips
Highlighted
Day One Tips

Tip: Use of "replace pattern" command to make the configuration changes

‎12-08-2010 04:22 PM

replace pattern <abc> with <xyz> under any configuration mode will be very useful when there needs to be change in the config.

 

This command is handy when user needs to delete an old pattern and set another pattern and when this particular pattern appears multiple times in the config.

It saves lots of time of deleting the config and seting new comfig.

 

3 REPLIES 3
Day One Tips

Re: Tip: Use of "replace pattern" command to make the configuration changes

‎04-12-2012 05:30 AM

This is very awesome command which helped me a lots while implementing naming conventions & interefaces config migrating to new interefaces:

 

show intereface | display-set

 

set interfaces fasteathernet 0/0/0 unit 0 family inet ip address 4.4.4.4/24

 

Ex1:

fw# set interfaces replace fastethernet 0/0/0 to gig-ethernet 2/0/0

 

The above command helps in migrating configuration from one interface to other interface. which also moves the content config to new interfaces.

Highlighted
Day One Tips

Re: Tip: Use of "replace pattern" command to make the configuration changes

‎07-05-2014 02:27 AM

fw# set interfaces replace fastethernet 0/0/0 to gig-ethernet 2/0/0 <<<< Is it a junos command ??

 

Thanks

Suresh

Highlighted
Day One Tips

Re: Tip: Use of "replace pattern" command to make the configuration changes

‎07-18-2014 08:05 AM

No it is not a valid command. Not sure why he showed that. You could do a rename - IE - rename intefaces fe-0/0/0 to ge-0/0/0 

 

Or do a replace pattern fe with ge

 

NOTE!! - This may be pretty self evident but the Junos configuration is hierarchical in nature. So when using replace you should ALWAYS do a search to determine the impact and then navigate to the right hierarchy prior to making any changes.

 

IE - to replace the value 192.168.10.1 first execute the following:

 

user@host# show | display set | match 192.168.10.1 

 

Using the display set option will not only show you lines that match the search criteria but will give you the complete syntax so you know where in the config it is located.

 

Kevin Barker
JNCIP-SEC
JNCIS-ENT, FWV, SSL, WLAN
JNCIA-ER, EX, IDP, UAC, WX
Juniper Networks Certified Instructor
Juniper Networks Ambassador

Juniper Elite Reseller
J-Partner Service Specialist - Implementation

If this worked for you please flag my post as an "Accepted Solution" so others can benefit. A kudo would be cool if you think I earned it.
Feedback