Community
    • Login

    Increase counter

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 4 Posters 666 Views 2 Watching
    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.
    • Daniel HolzmannD Offline
      Daniel Holzmann
      last edited by

      Hi,

      I have some report scripts, where I occasionally need to make some adjustments. E.g., in-between rows 5 and 6 I want to insert a new row, therefore all rows >= 6 would need to have the counter increased by one.

      R1=Blank,CustomHeaderStyle:font-weight:bold,CustomHeader:Phase 1,Style:background-color:#B2CBB6,NoSuppress
      R2=Blank,CustomHeaderStyle:font-style:Italic;font-weight:bold,CustomHeader:Deadline: WD2 EOD,Style:background-color:#B2CBB6,NoSuppress
      R3=A#ValidSup1004,Cell_Link4
      R4=A#ValidSup1005,Cell_Link5
      R5=A#ValidSup1014,Cell_Link14
        --> new row R6 inserted
      R6=A#ValidSup1015,Cell_Link15    (after insert should be R7)
      R7=A#ValidSup1016,Cell_Link16    (...R8)
      R8=A#ValidSup1017,Cell_Link17    (...R9)
      R9=A#ValidSup1018,Cell_Link18    (and so on)
      R10=A#ValidSup1024,Cell_Link24
      R11=A#ValidSup1025,Cell_Link25
      R12=A#ValidSup1026,Cell_Link26
      R13=A#ValidSup1027,Cell_Link27
      R14=A#ValidSup1028,Cell_Link27
      

      Is this possible to achieve via RegEx or any other option?

      Thanks,
      Daniel

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • L Offline
        litos81
        last edited by litos81

        Hi @Daniel-Holzmann ,

        if your scripts always follow the same or similar structure as the one you posted, one option could be (create a backup of your files first!):

        1- Insert your Rxx= row wherever is needed.
        2- Use a ‘regex replace’ with the expression ^R\d*= and leave empty the field ‘Replace with’ (and Replace All)
        3- With your cursor at the beginning of the first line , use the ‘Column editor’ Alt+C, select the option ‘Number to start’ and set the Initial number as 1 and Increase by 1.
        4- Again, with the cursor at the beginning of the file, open the Column Editor and this time use ‘Text to Insert’ with the character R.

        And I think that should do it.

        1 Reply Last reply Reply Quote 6
        • PeterJonesP Offline
          PeterJones @Daniel Holzmann
          last edited by

          @Daniel-Holzmann ,

          Alternatively, we have a whole FAQ on doing mathematical search-and-replace (assuming you are willing to use a plugin)

          Alan KilbornA 1 Reply Last reply Reply Quote 5
          • Alan KilbornA Offline
            Alan Kilborn @PeterJones
            last edited by

            @PeterJones said in Increase counter:

            assuming you are willing to use a plugin

            …AND take the leap into programming, if you’re not already a coder. (OK, it might be some light programming, if you copy+paste+change one of the provided examples).

            1 Reply Last reply Reply Quote 5
            • Daniel HolzmannD Offline
              Daniel Holzmann
              last edited by

              Thanks guys. I will go with litos81’s proposal which is working perfectly fine for what I need.
              The plug-in version I’d have considered for private purposes, but installing plug-ins on my work PC is always a big challenge for our IT department.

              1 Reply Last reply Reply Quote 1

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors