Community
    • Login

    Find / Replace with TOOLBUCKET

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.3k 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.
    • Rübel RundR
      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
        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
          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
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors