title: How do i write a way to "backspace" a line in a text document
body: <p>Im creating scripts in WinCC unified where javascript is used, i have some code which finds specific 3 lines in a text file and deletes the values there, it works but i wish to also basicaly delete the whole line, as if you were to press backspace when there's no text on a text line.</p>
  <p>The code</p>
  <pre><code>HMIRuntime.FileSystem.ReadFile(path, &quot;utf8&quot;).then(
  function(text) {
  const lines = text.split('\n');
  delete lines[noteNumber];
  delete lines[noteNumber+1];
  delete lines[noteNumber+2];
  //HMIRuntime.Trace(&quot;lines:&quot; +lines.join('\n')); 
  FileSystem.WriteFile(path, lines.join('\n'),&quot;utf8&quot; )
  });  
  </code></pre>
  <p>Thank you for any nice sould to help out.</p>
  <p>I have tried the splicing but now the part which reads the .txt file and writes its data into HMI arrays is not updating and the values are no longer being read. The code which reads the .txt file is here</p>
  <pre><code>HMIRuntime.FileSystem.ReadFile(path, &quot;utf8&quot;).then(
  function(text) {
  
   for (let i = 0; i &lt; maxNoteNumber; i++) {
   HMIRuntime.Trace(&quot;Trace Message&quot;+ text.split('\n',i));
   Tags('strDate[' + i + ']').Write(text.split('\n')[i*3]);
   Tags('strName[' + i + ']').Write(text.split('\n')[i*3+1]);
   Tags('strNote[' + i + ']').Write(text.split('\n')[i*3+2]);
   }
   }).catch(function(errorCode) {
   HMIRuntime.Trace(&quot;read error:&quot; + errorCode)
   for (let i = 0; i &lt;= maxNoteNumber; i++) {
   Tags('strNote[' + i + ']').Write('\n')//emty overwrite
    }
    //create a emtpy file 
    HMIRuntime.FileSystem.WriteFile(path,&quot; &quot;, 'utf8').then(
    function() {
      HMIRuntime.Trace('Write file finished sucessfully');
      }).catch(function(errorCode) {
       HMIRuntime.Trace('Write failed errorcode=' + errorCode);
  });
  });
  </code></pre>