Community
    • Login

    delete entries with different termination and add a line to those entries

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 246 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Nuno PauloN
      Nuno Paulo
      last edited by

      Hello,
      I was wondering if someone could help me with a boring task I´m having. The idea is to delete an entry that repeats several times on a config file but with a different termination. Like so:
      ip x.x.x.x
      allow icmp
      status off
      snmp-index 12

          ip x.x.x.x
          allow icmp
         status off
         snmp-index 13
      

      So would like to delete snmp-index X in all entries
      and also add “status off” to all of them.

      Thank you!

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Nuno Paulo
        last edited by PeterJones

        @Nuno-Paulo ,

        Unfortunately, your post uses inconsistent indentation, and the forum interprets some, but not all, as putting it into a forum code box. Next time, make sure you paste your text exactly, then highlight all the pasted text in your post, then click the forum’s </> toolbar button, so that it all ends up in the same box with correct indentation.

        Your use of “termination” is too vague for me to be able to guess what you mean. And you don’t tell us how to know where “status off” should be added, or how to know what constitutes “an entry”

        It would be really nice if you showed before and after data in separate text boxes (using the </> button), like,

        before

        one
        block
        
        two
        blocks
        
        three
        blocks
        

        after

        1 block
        2 blocks
        3 blocks
        

        If we were to try to guess what you intended, it’s likely to be wrong, thus wasting both our time and yours. Good luck.

        ----

        Useful References

        • Please Read Before Posting
        • Template for Search/Replace Questions
        • Formatting Forum Posts
        • Notepad++ Online User Manual: Searching/Regex
        • FAQ: Where to find other regular expressions (regex) documentation
        1 Reply Last reply Reply Quote 3
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors