title: How to replace comma with new line
body: <p>I am getting input like s1,s2,s3,s4.i am writing it to file.</p>
  
  <p>Tried below way : </p>
  
  <pre><code>$ServerList = Get-Content "D:\ServerName.txt"
  Clear-Content -Path "D:\ServerName.txt"
  [IO.File]::ReadAllText($ServerList) -replace ',',"`r`n" | Out-File "D:\ServerName.txt"
  </code></pre>
  
  <p>But it is not writing anything.</p>
  
  <p>It should replace comma with newline to bring each server in new line.</p>
  
  <p>Please let me know where i am doing wrong.</p>