Add/Insert text before each line in Notepad++

If you have a list of items and you want to append text to each of these items, you can use the find and replace function of Notepad++. So press CTRL + H and in Find what , you enter ^. In Replace with, you enter the text you want to add before each new line. At the bottom of the dialog window, you should make sure Regular expression is ticked. Now choose Replace All and you have added text to every line (you selected) in Notepad Plus Plus!

The same can be applied if you want to add something at the end of each line. Simply use the dollar sign $ instead of ^.

notepadplusplus

A practical example I use this little trick for is adding FQDNs to my host file in Windows. So a list of websites will become a valid host file which will resolve FQDNs to their host name which is my local machine.

This:

a.admob.com
h2.msn.com
...

Becomes this:

127.0.0.1 a.admob.com
127.0.0.1 h2.msn.com
...

 

 

Author Bio

Thank you for your interest in my blog! On this miniblog, I write mostly short (technical) blog posts that might interest other people. Read more about me or feel free to contact me.

 

3 thoughts on “Add/Insert text before each line in Notepad++

Leave a Reply to Sheetal Cancel reply

Your email address will not be published. Required fields are marked *