I'd like to use PowerShell to remove superfluous spaces and replace them with a single comma between entries so I can convert the result to a working CSV file for further analysis.
Here is my code;
Get-Content –path C:\Users\USERNAME\Desktop\results.txt| ForEach-Object {$_ -replace "\s+" " " } | Out-File -filepath C:\Users\USERNAME\Desktop\results.csv
In the text file, the initial results are like this:
entry entry entry (all separated with 5 spaces)
What I want it to look like is this:
entry,entry,entry
So Excel will put them in separate cells.