I got a array which has the value(new line after every "text")
$result=@"
"first","line","of","text"
"second","line","of","text
third","line","of","text"
"fourth","line","of","text"
"@
I am trying to write a powershell code which searches for lines that start with " but does not end with ". If it matches the condition next line is joined to the matched line with a comma delimiter. Ex: second line matches the condition, so third line is joined with the second line with a comma in between. like the one below
"first","line","of","text"
"second","line","of","text,third","line","of","text"
"fourth","line","of","text"
So far I have this with me. But it only adds a , to EOL but does not join it. Please let me know what am I missing
$result=@()
foreach ($item in $result){
if ($item -notlike '*"')
{ $result+=$item+"," }
else
{ $result+=$item}
}