Community
    • Login

    Add exact text to front of each row

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 3 Posters 21.4k Views 3 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.
    • Kristi SlenkerK Offline
      Kristi Slenker
      last edited by

      I have a new notepad file that I generated from an excel file. I would like to add the text "Email re " (without the quotes) to the front of each row. I know I can simply copy and insert but with 590 rows I was hoping Notepad offered a more efficient solution?

      Scott SumnerS 1 Reply Last reply Reply Quote 0
      • Jim DaileyJ Offline
        Jim Dailey
        last edited by

        @Kristi-Slenker

        In the search and replace dialog enter ^ (which means at the beginning of the line) into the search box and Email re into the replace box. Be sure to check the Regular Expression checkbox in the bottom-left corner of the dialog box, then Replace All.

        1 Reply Last reply Reply Quote 1
        • Scott SumnerS Offline
          Scott Sumner @Kristi Slenker
          last edited by

          @Kristi-Slenker

          So there are a few ways to do this, maybe even more than those listed below. It is instructive to have different means, as the techniques could be useful in similar situations.

          Method 1:
          • Put the caret in column 1 of the first line you want to affect (since you said “each row”, this would be line 1).
          • Go to the Edit (menu) and invoke Column Editor…
          • In the Column Editor dialog box that pops up, tick Text to Insert
          • Put your desired text in the zone that appears below Text to Insert
          • Click OK
          • Notepad++ will add your specified text to the beginning of every line.
            Note: You can make the starting line for this action variable, but I don’t believe you can specify an end-point to this action; it affects all lines from the line of the caret up to and including the last line of the file.
          Method 2:
          • Make sure you are in “insert” mode rather than “overwrite” mode (check far-right of status bar for “INS” rather than “OVR”)
          • Put the caret in column 1 of the first line you want to affect (since you said “each row”, this would be line 1).
          • Go to the Edit (menu) and invoke Begin/End Select
          • Go to column 1 of the line ABOVE the last line you want to affect (since you said “each row”, this would be the line above the last line in the file).
          • Press and hold Ctrl and Alt while you press-and-release the down-arrow key.
          • You should have a double-height skinny caret in column 1 of the last line of the file and the line above.
          • Go to the Edit (menu) and invoke Begin/End Select
          • You should now have a skinny caret in column 1 of the entire file.
          • Type your desired text which will then appear at the start of every line.
          • Move the caret with an arrow key to return the caret to normal.
            Note: This can be made to affect only a desired range of lines in your file (doesn’t have to be ALL lines); determined by where you do the two Begin/End Selects.
          Method 3:
          • Go to the Edit (menu) and invoke Select All (default keycombo: ctrl+a)
          • Invoke the Replace dialog (Search menu, then Replace…)
          • In the Find-what zone, put ^
          • In the Replace-with zone, put your desired text
          • In the Search-mode zone, choose Regular expression
          • Tick the In selection checkbox
          • Press the Replace All button.
            Note: This can be made to affect only a desired range of lines in your file (doesn’t have to be ALL lines); determined by the range of lines in your selected text.
            Note: Apologies to @JimDailey , but I already had Method 3 typed when I saw you had responded–good thing we agree on the basic technique. :-)
          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