Community
    • Login

    Help with editing a file

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 2.2k 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.
    • JBlack788J
      JBlack788
      last edited by JBlack788

      Hello, I am working on something and I need to be able to turn a file like this:
      Banana
      Apple
      Mango
      Pear

      Into this:
      Banana-Banana
      Banana-Banana1
      Banana-Banana2
      Banana-Banana3
      Banana-Banana123
      Apple-Apple
      Apple-Apple1
      Apple-Apple2
      (continuing down)

      You get the point. Anyways, is there any way to do this in notepad++? A script or plugin I could download? Any help would be greatly appreciated.

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @JBlack788
        last edited by

        @JBlack788

        well it depends on how complex it goes.
        given
        Banana
        Apple
        Mango
        Pear

        and using regular expressions like

        find what: ^(.+)$
        replace with: \1-\1\r\n\1-\11\r\n\1-\12\r\n\1-\13\r\n\1-\1123
        

        would result in

        Banana-Banana
        Banana-Banana1
        Banana-Banana2
        Banana-Banana3
        Banana-Banana123
        Apple-Apple
        Apple-Apple1
        Apple-Apple2
        Apple-Apple3
        Apple-Apple123
        Mango-Mango
        Mango-Mango1
        Mango-Mango2
        Mango-Mango3
        Mango-Mango123
        Pear-Pear
        Pear-Pear1
        Pear-Pear2
        Pear-Pear3
        Pear-Pear123

        \1 = what was found in the line
        \r\n = carriage return new line feed on windows

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 1
        • JBlack788J
          JBlack788
          last edited by

          Thank you so much! This helped a great deal.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors