{"id":368,"date":"2021-09-03T19:59:59","date_gmt":"2021-09-03T19:59:59","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/programming-batch-to-find-text-insert-new-line-of-text-21827-html-2"},"modified":"2021-09-03T19:59:59","modified_gmt":"2021-09-03T19:59:59","slug":"programming-batch-to-find-text-insert-new-line-of-text-21827-html-2","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/batch-to-find-text-insert-new-line-of-text\/21827.html","title":{"rendered":"Batch to find text &#038; insert new line of text"},"content":{"rendered":"<p><td>I need to search all the .cs files in a directory <br \/>for the word &#8220;Members&#8221;, and then insert a new <br \/>line with text after it, say &#8220;Test&#8221;.  For example:<\/p>\n<p>Current file has:<br \/>&#8230;<br \/>Members<br \/>&#8230;<\/p>\n<p>After the insert:<br \/>&#8230;<br \/>Members<br \/>Test<br \/>&#8230;<\/p>\n<p>I edited the solution here: <br \/><a href=\"https:\/\/computing.net\/answers\/programmi\" target=\"_blank\" rel=\"noopener\">https:\/\/computing.net\/answers\/programming\/batch-to-find-text-add-new-line-of-text\/21255.html<\/a>, to my problem below:<\/p>\n<p>@echo off &gt; newfile &#038; setLocal enableDELAYedeXpansion<\/p>\n<p>FOR \/R C:tara %%a IN (*.cs) DO (<br \/>for \/f &#8220;tokens=1* delims= &#8221; %%i in (%%a) do (<br \/>&gt;&gt; newfile echo.%%i %%j<br \/>if &#8220;%%i&#8221; equ &#8220;Members&#8221; &gt;&gt; newfile echo Test<br \/>)<br \/>move \/y newfile &#8220;%%a&#8221;<br \/>)<\/p>\n<p>However, it does not change anything in the <br \/>file (only 1 file currently in that directory).  Any tips?<\/p>\n<p>Thanks!<\/p>\n<\/td>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","template":"","meta":{"inline_featured_image":false,"iawp_total_views":63},"question-category":[],"question_tags":[],"class_list":["post-368","question","type-question","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=368"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=368"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=368"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}