title: Merge line with the next line if last character is a semicolon using batch file
body: <p>I have a file with following 4 lines.</p>
  
  <pre><code>A;1;abc;&lt;xml/&gt;;
  ;2;def;&lt;xml
  &gt;hello world&lt;/xml&gt;;
  ;3;ghi;&lt;xml/&gt;;
  </code></pre>
  
  <p>Using the batch file, I need to combine lines such that if the line doesn't end end with a semicolon (;), combine the next line into the current line.</p>
  
  <p>So the desired output should be</p>
  
  <pre><code>A;1;abc;&lt;xml/&gt;;
  ;2;def;&lt;xml&gt;hello world&lt;/xml&gt;;
  ;3;ghi;&lt;xml/&gt;;
  </code></pre>
  
  <p>I am not very familiar with batch scripts but tried using <code>for /F</code> but no luck so far. </p>
  
  <p>As I understand, the logic should be to check the last character for each line, if it is not a semicolon, read the next line into current line.</p>
  
  <p>Further to this, I managed to get the last character of the line but my script only reads the line if it doesn't being with ; . Any ideas?</p>
  
  <pre><code>@echo off
  for /f "tokens=*" %%i in (myfile.txt) do (
    set var=%%i
    echo %%i
    if "%var:~-1%"==";" (
      echo test
    )
  )
  </code></pre>
  
  <p>Note: the above query only reads line 1 and 3.</p>