Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
Junos CLI Reference
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

replace

date_range 19-Nov-23

Syntax

content_copy zoom_out_map
replace pattern pattern1 with pattern2 <upto n>

Description

Replace identifiers or values in a configuration.

Options

pattern1

Text string or regular expression that defines the identifiers or values you want to match.

pattern2

Text string or regular expression that replaces the identifiers and values located with pattern1. Juniper Networks uses standard UNIX-style regular expression syntax (as defined in POSIX 1003.2). If the regular expression contains spaces, operators, or wildcard characters, enclose the expression in quotation marks. Greedy qualifiers (match as much as possible) are supported. Lazy qualifiers (match as little as possible) are not.

upto n

Number of objects replaced. The value of n controls the total number of objects that are replaced in the configuration (not the total number of times the pattern occurs). Objects at the same hierarchy level (siblings) are replaced first. Multiple occurrences of a pattern within a given object are considered a single replacement. If you do not specify an upto option, all identifiers and values in the configuration that match pattern1 are replaced.

Required Privilege Level

configure—To enter configuration mode, but other required privilege levels depend on where the statement is located in the configuration hierarchy.

Release Information

Command introduced in Junos OS Release 7.6.

footer-navigation