title: Reading line by line from one file and write to another file using batch script
body: <p>In below code i am tring to fetch the line no of string "AXX0000XXXA" from file data.txt,then fetching line by line and printing target.txt file,in between if the line reach the find line no i am adding one more line from file temp.txt.The code is working fine with the less nos of records(tested with 150 lines-File Size 100 kb),but when i am processing with 50K records(File Size 25MB) it is taking more then 25 minutes to process.could you please help me how i will process same in less time.</p>
  
  <pre><code>@echo off
  setlocal enabledelayedexpansion
  for /f "delims=:" %%a in ('findstr /n "AXX0000XXXA" "C:\Users\23456\Desktop\data.txt"') do (set find_line=%%a)
  set /a counter=0
  for /f "usebackq delims=" %%b in (`"findstr /n ^^ C:\Users\23456\Desktop\data.txt"`) do ( 
  set curr_line=%%b
  set /a counter=!counter!+1 
  if !counter! equ !find_line! (
      type temp.txt &gt;&gt; target.txt
  )
  call :print_line curr_line
  )
  endlocal
  
  :print_line
  setlocal enabledelayedexpansion
  set line=!%1!
  set line=!line:*:=!
  echo !line!&gt;&gt;target.txt
  endlocal
  </code></pre>