Notepad++ Add Text to the End of Each Line

Random

Notepad++ can be quite a handy tool to use, I often use it when building up bulk CLI commands to enter into switches or firewalls. Say you had a list of hosts and wanted to add some text to the beginning, that’s fairly easy, you just click, hold ALT and then select all the lines, then you just start typing.

But what about adding something to the end of each line?

Well you can do that easily too using the “find and replace” option. As an example let’s say i’ve got these firewall CLI commands to add three objects that can be used in rules (okay there’s only 3, but what if there were 300), and you want to add the domain suffix of “turnip.com” to the end of them all how would you do it?

set address server1 fqdn server1
set address server2 fqdn server2
set address server3 fqdn server3

All you need to do is click “Search”->”Replace”, then when the dialog appears click the “Regular Expression” radio button.

Now enter the below “$” within the “Find what” text box, the dollar sign means end of line, in this case we just want to append “turnip.com” to the end of the line.

Now click on “Replace All” and hey presto, you’ll see the “.turnip.com” has been added to the end of each line!

Image Attribution

Leave a Reply

Your email address will not be published.