title: Powershell Delete String in text file
body: <p>I have a file that I am downloading daily what I want to do is create a script that reads the text file and deletes out any lines containing the string "---" </p>
  
  <p>I started with <code>"(get-content L:\holdings.txt) | where {$_ -ne "" | out-file holdings.txt"</code></p>
  
  <p>This deletes all the blank lines without any issue, I then tried </p>
  
  <pre><code>$del -like "*-*"
  "(get-content L:\holdings.txt) | where {$_ -ne $del | out-file L:\holdings.txt"
  </code></pre>
  
  <p>Which I though would delete out any of the lines of data, whilst it runs without error the line is not being deleted out... </p>
  
  <p>I don't know if it's relevant but the line I want to delete will always be the second line as it is a comma delimited SQL batch file automation. </p>
  
  <p>The file reads as follows</p>
  
  <p>Advice Num          ,Bargain Number<br>
  --------------------,-----------------</p>
  
  <p>Just to try and give you a graphical representation that I am trying to resolve</p>
  
  <p>Any ideas? </p>
  
  <p>Regards</p>
  
  <p>Richard</p>