title: Overriding content of output input file from second line in PowerShell
body: <p>I am copying content of my input file to a output file, I am able to override current data of output file using set-content but I don't want to override the headers. Headers should remain as it is and input file content should be added after second line. Also once I repeat the same activity , it should add the output after second line and previous data should be override excluding headers.
  How we can achieve this?</p>
  <p>I am using below code but its appending content of $destRoot1 to $destRoot2.
  It should override existing content excluding first line(headers).</p>
  <pre><code>Add-Content -Path $destRoot2 &quot;`n&quot;
  Get-content -Path $destRoot1 | Add-Content -Path $destRoot2 -Encoding UTF8
  ((Get-Content -Path $destRoot2) -notmatch '^\s*$' )| Select-Object -Unique |             
  Set-Content -Path $destRoot2 -Encoding UTF8
  Clear-Content $destRoot1
  </code></pre>
  <p>destroot1 is like below</p>
  <pre><code>Warmup,18/02/2021 05:00:00,18/02/2021 05:06:04,Success
  root_Job_1,02/02/2021 06:27:34,02/02/2021 06:28:37,Failure
  root_Job_2,02/02/2021 06:27:34,02/02/2021 06:28:16,Success
  root_Job_3,02/02/2021 06:27:34,02/02/2021 06:41:58,Success
  root_Job_4,02/02/2021 06:38:00,02/02/2021 06:38:01,Failure
  root_Job_1,02/02/2021 06:27:34,02/02/2021 06:30:11,Failure
  </code></pre>
  <p>destroot2 will only contain headers :</p>
  <pre><code>job_name,start_time,end_time,status
  </code></pre>
  <p>I need to append the data of destroot1 to destroot2  after headings as well as once I run script again, it should remove the data after headings and updated data from destroot1</p>