{"id":959,"date":"2022-06-25T12:28:53","date_gmt":"2022-06-25T12:28:53","guid":{"rendered":"https:\/\/www.geekmungus.co.uk\/?p=959"},"modified":"2022-11-05T10:53:18","modified_gmt":"2022-11-05T10:53:18","slug":"notepad-add-text-to-the-end-of-each-line","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=959","title":{"rendered":"Notepad++ Add Text to the End of Each Line"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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&#8217;s fairly easy, you just click, hold ALT and then select all the lines, then you just start typing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But what about adding something to the end of each line?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Well you can do that easily too using the &#8220;find and replace&#8221; option. As an example let&#8217;s say i&#8217;ve got these firewall CLI commands to add three objects that can be used in rules (okay there&#8217;s only 3, but what if there were 300), and you want to add the domain suffix of &#8220;turnip.com&#8221; to the end of them all how would you do it?<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set address server1 fqdn server1\nset address server2 fqdn server2\nset address server3 fqdn server3<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">All you need to do is click &#8220;Search&#8221;-&gt;&#8221;Replace&#8221;, then when the dialog appears click the &#8220;Regular Expression&#8221; radio button.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now enter the below &#8220;$&#8221; within the &#8220;Find what&#8221; text box, the dollar sign means end of line, in this case we just want to append &#8220;turnip.com&#8221; to the end of the line.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.geekmungus.co.uk\/wp-content\/uploads\/2022\/06\/image.png\" alt=\"\" class=\"wp-image-960\" width=\"658\" height=\"363\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now click on &#8220;Replace All&#8221; and hey presto, you&#8217;ll see the &#8220;.turnip.com&#8221; has been added to the end of each line!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.geekmungus.co.uk\/wp-content\/uploads\/2022\/06\/image-1.png\" alt=\"\" class=\"wp-image-961\" width=\"707\" height=\"362\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/unsplash.com\/@markusspiske\" data-type=\"URL\" data-id=\"https:\/\/unsplash.com\/@markusspiske\" target=\"_blank\" rel=\"noreferrer noopener\">Image Attribution<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;s fairly easy, you just click, hold ALT and then select all the lines, &#8230; <a title=\"Notepad++ Add Text to the End of Each Line\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=959\" aria-label=\"Read more about Notepad++ Add Text to the End of Each Line\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":965,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-959","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-random"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/959","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=959"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/959\/revisions"}],"predecessor-version":[{"id":1341,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/959\/revisions\/1341"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}