• Login
Community
  • Login

how to append the numbers with specific string ??

Scheduled Pinned Locked Moved General Discussion
5 Posts 3 Posters 516 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.
  • K
    kamal lochan
    last edited by Dec 13, 2020, 5:58 AM

    hfshfdohoh kamal from which build the issue is comming need to check it out .
    nscknkjnkjdnjknnkjnjd jnnfdnfn kamal from which build the issue is comming need to check it out .
    nndnfdoihiofdhoifdhoi dnidihdi nindiididkamal from which build the issue is comming need to check it out .
    jbffbufb kamal from which build the issue is comming need to check it out .
    hfhfjfj kamal from whickamal from which build the issue is comming need to check it out .
    nidididn kamal from which build the issue is comming need to check it out .
    nnidnid kamal from which build the issue is comming need to check it out .

    in the above text ,wherever kamal is there ,kamal 1 ,kamal 2 ,kamal 3 should come …so out put text should be :-

    output text:

    hfshfdohoh kamal1 from which build the issue is comming need to check it out .
    nscknkjnkjdnjknnkjnjd jnnfdnfn kamal2 from which build the issue is comming need to check it out .
    nndnfdoihiofdhoifdhoi dnidihdi nindiidid kamal3 from which build the issue is comming need to check it out .
    jbffbufb kamal4 from which build the issue is comming need to check it out .
    hfhfjfj kamal5 from whickamal from which build the issue is comming need to check it out .
    nidididn kamal6 from which build the issue is comming need to check it out .
    nnidnid kamal7 from which build the issue is comming need to check it out .

    1 Reply Last reply Reply Quote 0
    • K
      kamal lochan
      last edited by Dec 13, 2020, 6:00 AM

      another example:

      input text:

      kamal kamal kamal kamal

      kamal kamal kamal kamal

      output text:

      kamal 1 kamal 2 kamal 3 kamal 4

      kamal 5 kamal 6 kamal 7 kamal 8

      P 1 Reply Last reply Dec 13, 2020, 6:31 PM Reply Quote 0
      • P
        PeterJones @kamal lochan
        last edited by Dec 13, 2020, 6:31 PM

        @kamal-lochan ,

        The Notepad++ search engine does not have a way to auto-increment a counter in the replacement string.

        There are two ways that I can think of to get around this:

        1. If you know the maximum number of instances you are going to hit, you could use a trick that @guy038 uses, which is to add a list of numbers at the end of the document after some sort of unique marker line (you can add the numbers easily using the Edit > Column Editor), then use a search-and-replace that grabs the first item from the after-marker list and appends it to the match. This post by @guy038 about merging two files might be a conceptual starting place for you.

        2. If you are willing to add a plugin like PythonScript, you can use the editor.research method to call a function which will increment the number. This post shows an example ripped from the PythonScript docs that adds one to each number found in the document; a slightly modified version could be used to add one to a global variable, and then use that global variable in the replacement for each match.

        A P 2 Replies Last reply Dec 13, 2020, 6:56 PM Reply Quote 0
        • A
          Alan Kilborn @PeterJones
          last edited by Dec 13, 2020, 6:56 PM

          @PeterJones

          You’re probably about to find out that we have yet another user that likes to open multiple threads to ask the same question over and over; see HERE

          1 Reply Last reply Reply Quote 0
          • P
            PeterJones @PeterJones
            last edited by Dec 13, 2020, 6:59 PM

            warning to future readers

            @kamal-lochan asked the identical question in a separate topic, where the dicussion continued.

            please don’t do that

            @kamal-lochan , This is frustrating to people who want to help you. I hadn’t read to the repost of your question yet, so I spent 10 minutes coming up with a reply and posted that; it wasn’t until another member messaged me to inform me that the question was re-asked there (and then @Alan-Kilborn posted here to let me know as well) that I found out you’d asked your question twice – and that others had already answered you hours ago.

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