I’d be happy to have ya putting stuff in variables instead of in files as an interim holding area .
So, a couple of things: Arrays don’t “have” commas or carriage returns. An array is (basically) a collection of objects. PowerShell interprets comma-separated lists as arrays ($array = 1,2,3) and when it reads a file, it uses newline (CRLF) characters to return each line of the file as an object – meaning the entire file is interpreted as an array of strings.
So if I had things at the top in $topmost ($topmost = ‘peach’,'plum’), and I had other objects in $main ($main = ‘apple’,'pear’,'mango’), I would probably do:
$sorted_main = $main | sort-object
$topmost,sorted_main | select -unique
As a quick way to get my list.