replace values with incrementing by1



  • Hi All,
    i have 10k lines and i want to replace values in each line starting with 242 character to 253.
    example:
    Example file:
    777777777777777777775000036-020161207
    888888888888888888885000047-020161208
    999999999999999999995000048-020131209

    My wish :-)
    777777777777777777776000036-020161207
    888888888888888888886000037-020161208
    999999999999999999996000038-020131209

    replace the value with incrementing by 1.



  • @mallikarjuna-navuluri said in replace values with incrementing by1:

    replace the value with incrementing by 1

    You will need to explain further. The example provided is confusing as I see the 5 are the repeated 7,8 and 9 seems to have incremented by 1, however the number to the right (after the repeated 0) is different in 2 lines. How did that happen, an error on your part or was it intentional and you neglected to add this request to your post.

    Also, please when posting examples we need them inside a black box, this prevents the posting engine from possibly altering the example text. This is achieved in the window in which you type by using the </> button immediately above the window. Enter your example and use this button before the example text and after it.

    Terry



  • Hi Terry,
    sorry for the confusion.
    in a simple way i have a value xxxxxxx from 242 character to 253 character.
    now i want to replace that value starting from the first row 10k row with an value incrementing by1.
    example i want to replace first line with 5000001, secondline with 5000001
    third line with 5000003…10k line will be 5010000.



  • @mallikarjuna-navuluri said in replace values with incrementing by1:

    example i want to replace first line with 5000001, secondline with 5000001
    third line with 5000003…10k line will be 5010000.

    There is a menu option in Notepad++ to insert into a set position on each line a number. This number (or text) can be static or if a number can be incremented by another number, in your case 1.

    So look at the Edit Menu, then Column Editor. Use the “Number to Insert” option and start with the first number you want and have the increment as 1. Since the start and end numbers in your post are the same length you don’t need to include leading zeros.

    If you have the cursor in the very first position of your file and start this column editor function every line in the file will have a number at the start of the line. You may want to use the “insert text” first so you have a space between the numbers but not necessary as the number you are inserting is one set length.

    Then you’d cut that number and insert it further along in the line.

    Again, I’ll repeat my request. You need to supply more examples and use the black box surrounding the examples to prevent any characters being altered by the posting engine. So perhaps 3-4 lines gathered together and perhaps another 3-4 further along in the file showing a latter part of it so we get a good idea of what the original data looks like.

    Terry


Log in to reply