I have a following array of strings
$array = @("asdf asdf","aaa ddd","cccc a","aaaa dd")
and I would like to split every element of that array by a new line and put the result into array
So expected result should look as follows
@("asdf", "asdf", "aaa", "ddd", "cccc", "a", "aaaa", "dd")
I would like to avoid using nested foreach statement and preferably use some kind of SelectMany syntax
So far I've tried
$result = $array | %{$_.Split([Environment]::NewLine)}
$result = $array | Select-Object -ExpandProperty $_.Split([Environment]::NewLine)
but with no luck. Any thoughts?