I generally don't do much parsing however and am in need of some help. I have a plain text file that has the following format.
IP, Status, Server_Name, DNS_Name, Version, Authentication
IP, Status, Server_Name, DNS_Name, Version, Authentication
IP, Status, Server_Name, DNS_Name, Version, Authentication
etc..
Unfortunately when I try a simple copy and pasting onto a spreadsheet, for whatever reason I'm unable to properly paste the entire spreadsheet onto separate cells. Instead, whenever I paste I'm getting the entire spreadsheet put into one cell. I figured I could manage to do this using either python or powershell, either method works for me, what I'm having trouble with is implementation. I'd like to use the commas between each object as a method of signifying a new cell.
Currently trying to use Powershell I have the following that doesn't work (I don't mind doing this in python either).
$pattern = ','
$content = Get-Content D:\Scripts\Temp\p.txt | Out-String
$content.Split($pattern) | Where-Object {$_ -match ','} | ForEach-Object {
$item = $_ -split "," | Where-Object {$_}
New-Object PSobject -Property @{
Name=$item[0].Split(',')[-1].Trim()
Id = $item[1].Split(',')[-1].Trim()
ResolutionPath=$item[2].Split(',')[-1].Trim()
Endpoints=$item[4..($item.Count)]
} | Select-Object Name,Id,ResolutionPath,Endpoints
}