The following example shows how you can use the \n back reference to replace a pattern:
- [edit]
- user@host# show interfaces
- xe-0/0/0 {
- unit 0;
- }
- fe-3/0/1 {
- vlan-tagging;
-
- unit 0 {
- description "inet6 configuration. IP: 2000::c0a8::1bf5";
- vlan-id 100;
-
- family inet {
- address 17.10.1.1/24;
- }
-
- family inet6 {
- address 2000::c0a8:1bf5/3;
- }
- }
- }
- [edit]
- user@host# replace pattern "(.*):1bf5" with
"\11bf5"
- [edit]
- user@host# show interfaces
- xe-0/0/0 {
- unit 0;
- }
- fe-3/0/1 {
- vlan-tagging;
-
- unit 0 {
- description "inet6 configuration. IP: 2000::c0a8:1bf5";
- vlan-id 100;
-
- family inet {
- address 17.10.1.1/24;
- }
-
- family inet6 {
- address 2000::c0a8:1bf5/3;
- }
- }
- }
The pattern 2000::c0a8::1bf5 is replaced with 2000::c0a8:1bf5.