If I understand that condition correctly, you could do something like this
$url="http://server-name/folder/hosts_in_mm_list.txt"$reply=Invoke-WebRequest$url$tgtHosts="host1","host2","host3"
$tgtComment="Target comment"
$hostnames=$reply.Content|%{ $hostname,$comment=$_.Split(',') if($tgtHosts-contains$hostname-and$tgtComment-eq$comment){ $hostname
} }
I assume that the content can be handled line by line. If not, there probably needs to be a split on <CR> or <LF> or both.
The input is split, line by line, on the comma.
In $tgtHosts I have the names of the hosts you are looking for.
In $tgtComment I have the comment text you are looking for.
All hostnames that fit the condition are stored in $hostnames.