how to append the numbers with specific string ??



  • 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 .



  • 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



  • @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.



  • @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



  • 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.


Log in to reply