title: How to Extract and copy content from one file to another using batch script?
body: <p>I have a main.c file which content looks like</p>
  <pre><code>const uint8 array1[] =
  {
  0x00,0x12 , ....
  ....,
  ....,
  ....,
  }
  
  const uint8 array2[] =
  {
  0x00,0x12 , ....
  ....,
  ....,
  ....,
  }
  
  /* Data dictionary */
  
  const arrayInfoType Images[SIZE] =
  {
    /* [0] = */
    {
     /* .pDataSource = */
    (uint8*)array1,
     /* .DestAddr = */
    (uint32)   0x00000000,
    /* .DataLength = */
    (uint32)   0x00002cA7
    },
    /* [1] = */
    {
     /* .pDataSource = */
    (uint8*)array2,
     /* .DestAddr = */
    (uint32)   0x00017000,
    /* .DataLength = */
    (uint32)   0x00026342
    },
  };
  </code></pre>
  <p>I wanted to copy only DataLength values to a header which looks like</p>
  <pre><code>#ifndef Img_included
  #define Img_included
  
  #define NO_OF_ARRAYS 2u
  #define Size_Array0        0x000053A7    
  #define Size_Array1        0x0002516C
  extern  const arrayInfoType Images[SIZE];
  
  #endif
  </code></pre>
  <p>how to overwrite SIZE_Array0 value in header with content of Data length of array 0 form C file and same thing for Array 1 using batch script .</p>
  <p>I tried using FINDSTR but not getting proper output.
  Script what I was trying to use to extract content of C file .</p>
  <pre><code>FOR /F &quot;tokens=*&quot; %%A IN ('FINDSTR /N &quot;uint32&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;}&quot; &quot;%TempFile%&quot;&gt;&gt; &quot;%OutFile%&quot;
  FOR /F &quot;tokens=*&quot; %%C IN ('FINDSTR &quot;}&quot; &quot;%InFile%&quot;') DO (
  CALL :RemoveWordB &quot;%%C&quot;
  IF EXIST &quot;%TempFile%&quot; DEL &quot;%TempFile%&quot;
  GOTO :eof
  )
  )
  )
  GOTO :eof
  </code></pre>