• Login
Community
  • Login

Add exact text to front of each row

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 3 Posters 18.8k Views
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.
  • K
    Kristi Slenker
    last edited by Aug 24, 2017, 10:06 PM

    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?

    S 1 Reply Last reply Aug 25, 2017, 12:44 PM Reply Quote 0
    • J
      Jim Dailey
      last edited by Aug 25, 2017, 11:52 AM

      @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
      • S
        Scott Sumner @Kristi Slenker
        last edited by Aug 25, 2017, 12:44 PM

        @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
        1 out of 3
        • First post
          1/3
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors