Community
    • Login

    Find / Replace with TOOLBUCKET

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.5k Views 2 Watching
    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.
    • Rübel RundR Offline
      Rübel Rund
      last edited by

      Hello NPP-experts,

      i would like to add a new line to a big file after a finding section. How can i do this? I have installed the plugin TOOLBUCKET - Multiline Find Replace. Not in every section i need this new line. To example i create a samplefile with car company’s. My idea was with reg exp.
      FIND: (^automarke_._deutschlandDiesel)
      REPLACE: \1\n NEW LINE
      -> does not work

      myfile with more than 120000 lines:

      automarke_opel_deutschland
      Ascona
      Kadett
      Corsa
      Diesel not in every section
      ###Here add a new line###

      automarke_audi_deutschland
      A3
      A5
      A6
      Benzin
      ###NO new line###

      automarke_opel_deutschland
      Ascona
      Kadett
      Corsa
      Diesel not in every section
      ###Here add a new line###

      Thanks a lot

      Scott SumnerS 1 Reply Last reply Reply Quote 2
      • Scott SumnerS Offline
        Scott Sumner @Rübel Rund
        last edited by

        @Rübel-Rund

        So you might start with this text (maybe better than your exact example, which embeds meta stuff in it):

        automarke_opel_deutschland
        Ascona
        Kadett
        Corsa
        Diesel
        
        automarke_audi_deutschland
        A3
        A5
        A6
        Benzin
        
        automarke_opel_deutschland
        Ascona
        Kadett
        Corsa
        Diesel
        

        And you want to turn it into this:

        automarke_opel_deutschland
        Ascona
        Kadett
        Corsa
        Diesel
        foobar
        
        automarke_audi_deutschland
        A3
        A5
        A6
        Benzin
        
        automarke_opel_deutschland
        Ascona
        Kadett
        Corsa
        Diesel
        foobar
        

        I don’t think TOOLBUCKET provides you anything over-and-above what standard regular-expression replace gives you for this…

        So really quickly (I’m sure there are better ways) you can do it with this:

        Find what zone: (?-s)automarke_.+?_deutschland(?s).+?^(?:(Diesel).+?^$|$)
        Replace with zone: $0(?1foobar\r\n)

        Note: Assumes Windows line-endings (\r\n).

        1 Reply Last reply Reply Quote 1
        • Rübel RundR Offline
          Rübel Rund
          last edited by

          Thanks a lot.

          It works with a little change(REPLACE: $0(HELLO WORLD\r\n) ) in my file.

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors