Add exact text to front of each row



  • 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?



  • @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.



  • @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. :-)

Log in to reply