Add suffix only to bookmarked lines



  • Hi, How can i add suffix only to bookmarked lines?
    For ex:
    1
    2
    3
    4

    say i have bookmarked 3, now i want to use the $ function to add a suffix to it, How can i do it?

    Above is a simplified version, i have to maintain the order in the actual file , so i just can’t copy the bookmarked lines to new txt and do the needed operation there, thanks.



  • @Vf-Dvr said in Add suffix only to bookmarked lines:

    say i have bookmarked 3, now i want to use the $ function to add a suffix to it, How can i do it?

    If you used a regex to bookmark the lines, then it seems that you could have edited those lines with a slight change to the regex used instead of just bookmarking them.

    If however you have manually bookmarked the lines then the following might work for you. Please read in entirety before commencing and ask questions if in doubt.

    1. Go to the first line, and place cursor in the first position.
    2. Use Edit, then Column Editor and Number to insert. start at 1 with increase also set to 1, and have leading zero ticked. Click OK, this will place ascending line numbers for every line in the file. Note it will not remove the bookmarks.
    3. Use Search, Bookmark, then Cut bookmarked lines and place those lines into another tab within Notepad++
    4. Edit these lines as you wish.
    5. Copy these lines back to the original document and re-sort.
    6. Remove the leading line numbers using a regex with ^\d+. This may need checking depending on your real lines as if they contain a leading number already this will remove all the numbers at the start.

    Terry



  • that works! thanks Terry.


Log in to reply