Parse text from csv file

$fpath = 'C:\Uyour path\some file.csv' #Select 5th line $fname = Get-Content $fpath| Select -Index 4 #Remove empty columns $option= [System.StringSplitOptions]::RemoveEmptyEntries #split on comma $string = $fname.Split("(,)",$option) #remove quotes and spaces $cstring = $string -replace '"',"" -replace " ","" #write out first 2 lines Write-Output $cstring[0] Write-Output $cstring[1]
Code is commented.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.