Reputation: 93
I have a text file containing the below test data:
1234
\\test
QATest
Silk
Chrome
I have a requirement to convert this text file into a CSV file using Powershell which would look somewhat like
1234,\\test,QATest,Silk,Chrome
Could anybody please suggest the right way?
Upvotes: 0
Views: 958
Reputation: 174485
Read all the lines in, then concatenate them using the -join
operator:
$originalLines = Get-Content .\input.txt
$originalLines -join ',' |Set-Content .\output.csv
Upvotes: 2