title: Extract content from 1 .txt save to another .txt using bat file
body: <pre><code>@ECHO OFF
  SET InFile=nsb.txt
  SET OutFile=Output.txt
  IF EXIST &quot;%OutFile%&quot; DEL &quot;%OutFile%&quot;
  SET TempFile=Temp.txt
  IF EXIST &quot;%TempFile%&quot; DEL &quot;%TempFile%&quot;
  FOR /F &quot;tokens=*&quot; %%A IN ('FINDSTR /N &quot;wordA&quot; &quot;%InFile%&quot;') DO (
     CALL :RemovePrecedingWordA &quot;%%A&quot;
     FOR /F &quot;tokens=1 delims=:&quot; %%B IN ('ECHO.%%A') DO (
        MORE +%%B &quot;%InFile%&quot;&gt; &quot;%TempFile%&quot;
        FINDSTR /V &quot;wordB&quot; &quot;%TempFile%&quot;&gt;&gt; &quot;%OutFile%&quot;
        FOR /F &quot;tokens=*&quot; %%C IN ('FINDSTR &quot;wordB&quot; &quot;%InFile%&quot;') DO (
           CALL :RemoveWordB &quot;%%C&quot;
           IF EXIST &quot;%TempFile%&quot; DEL &quot;%TempFile%&quot;
           GOTO :eof
           )
        )
     )
  GOTO :eof
  :RemovePrecedingWordA
  SET String=%~1
  SET String=%String:*wordA =%
  ECHO.%String%&gt; &quot;%OutFile%&quot;
  GOTO :eof
  
  :RemoveWordB
  REM Replace &quot;wordB&quot; with a character that we don't expect in text that we will then use as a delimiter (` in this case)
  SET LastLine=%~1
  SET LastLine=%LastLine:wordB=`%
  FOR /F &quot;tokens=1 delims=`&quot; %%A IN ('ECHO.%LastLine%') DO ECHO.%%A&gt;&gt; &quot;%OutFile%&quot;
  </code></pre>
  <p>GOTO :eof</p>
  <p>OK so I found this code and I see how it works, and what it does is what I am looking for, but I don't know how to make sure I'm editing this code to work for my case. <br></p>
  <p>I have a .txt file and inside I have 110 repeated content with 98% identical content, except 2 codes change per new content. Now my list is very long, so I will shorten it up, and I will have my example be around 99% identical. <br>
  { &lt; -------------- The content I want to extract starts with this open bracket (1) <br>
  &quot;unid&quot;: 1, <br>
  &quot;crdb&quot;: &quot;Abarth_500_2014&quot;, <br>
  &quot;awar&quot;: false, <br>
  &quot;grsp&quot;: [ <br>
  &quot;livid&quot;: 126, <br>
  &quot;whbn&quot;: &quot;Wheel6B_3D&quot;, <br>
  &quot;tlad&quot;: 0.0, <br>
  &quot;need&quot;: false, <br>
  &quot;cmlv&quot;: 0 <br>
  }, &lt; -------------- and the content ends here, (11) so I want to extract from line (1) to line (11) <br>
  { &lt; -------------- This is were my new content start <br>
  &quot;unid&quot;: 2, <br>
  &quot;crdb&quot;: &quot;Abarth_500_2014&quot;, <br>
  &quot;awar&quot;: false, <br>
  &quot;grsp&quot;: [ <br>
  &quot;livid&quot;: 127, <br>
  &quot;whbn&quot;: &quot;Wheel6B_3D&quot;, <br>
  &quot;tlad&quot;: 0.0, <br>
  &quot;need&quot;: false, <br>
  &quot;cmlv&quot;: 0 <br>
  }, &lt; ------------- and the second contact ends here, please keep in mind I have 110 files to extract and all extractions will create it's own .txt, so at the end I want to have 110 .txt <br></p>
  <p>I was wondering if there was a way to extract data based on line code, since every start and end of my content have the same number of lines, if a code can be use to find lets say line 4000 to 4050, next content will start 4051 to 4101, and so on <br></p>
  <p>Thank you for any ideas that will work. <br></p>