delete same configuration statement in multiple places in configuration file

m4rtinm4rtin Member Posts: 170
Is it possible to remove same configuration statement under multiple interfaces configuration at once? For example how to delete "rpf-check" under all the interfaces below at once:
interfaces {
    ae0 {
        unit 105 {
            description "TEST 1";
            bandwidth 8m;
            family inet {
                rpf-check;
                mtu 1500;
                policer {
                    input bw-8Mbps;
                    output bw-8Mbps;
                }
                address 10.10.11.57/30;
            }
        }
        unit 135 {
            description "TEST 2";
            bandwidth 8m;
            family inet {
                rpf-check;
                mtu 1500;
                policer {
                    input bw-8Mbps;
                    output bw-8Mbps;
                }
                address 10.10.12.61/30;
            }
        }
        unit 203 {
            description "TEST 3";
            bandwidth 2m;
            family inet {
                rpf-check;
                mtu 1500;
                policer {
                    input bw-2Mbps;
                    output bw-2Mbps;
                }
                address 10.10.15.41/30;
            }
        }
    }
}


I tried with:
delete interfaces <*> unit <*> family inet rpf-check

..and:
replace pattern rpf-check with ""

..but both of those did not work. Is it possible to delete using wildcards? Or in general, is it possible to delete same configuration statement in multiple places in configuration file at once?

Comments

  • dead_p00ldead_p00l Member Posts: 136
    Disregard, misread the original post.
    This is our world now... the world of the electron and the switch, the
    beauty of the baud.
  • m4rtinm4rtin Member Posts: 170
    dead_p00l wrote: »
    Disregard, misread the original post.

    What do you mean? :)
  • networker050184networker050184 Mod Posts: 11,962 Mod
    Have you tried the 'wildcard delete' command?

    Not sure if you can get it to work for you here though. Why not just compile a list of interfaces and manually delete? Should be a fairly easy task if you can pull the configurations off of backups or something.
    An expert is a man who has made all the mistakes which can be made.
  • m4rtinm4rtin Member Posts: 170
    Have you tried the 'wildcard delete' command?

    Not sure if you can get it to work for you here though.

    Yes, I tried with "wildcard delete", but it requires regular expression to be the final statement. It's pointed out in documentation as well: Using Regular Expressions to Delete Related Items from a JUNOS Configuration - JUNOS 10.0 CLI User Guide

    Why not just compile a list of interfaces and manually delete? Should be a fairly easy task if you can pull the configurations off of backups or something.

    Could you explain this method bit further?
  • AhriakinAhriakin Member Posts: 1,799 ■■■■■■■■□□
    The not so clever but simple way would be just to a "show conf interfaces | match rpf-check | display set", paste it out to Notepad, replace set with delete, paste it back.
    We responded to the Year 2000 issue with "Y2K" solutions...isn't this the kind of thinking that got us into trouble in the first place?
  • networker050184networker050184 Mod Posts: 11,962 Mod
    What Ahriakin said is what I would do. Or just have a script run through your configs and pull a list of interfaces to delete it on if you want to get fancy. If you suck at scripting like me it will probably take you just as long to write the script as to do it manually though!
    An expert is a man who has made all the mistakes which can be made.
Sign In or Register to comment.