If this (artist name, etc.) will be just one word:
$Arr = "1 string first", "2 string second", "3 string third", "4 string fourth" $common = $Arr | %{ $_.split() } | group | sort -property count | select -last 1 | select -expand name $common = " {0} " -f $common
Update:
An implementation that works for multiple words (finding the longest common substring of words):
$arr = "1 string a first", "2 string a second", "3 string a third", "4 string a fourth" $common = $arr | %{ $words = $_.split() $noOfWords = $words.length for($i=0;$i -lt $noOfWords;$i++){ for($j=$i;$j -lt $noOfWords;$j++){ $words[$i..$j] -join " " } } } | group | sort -property count,name | select -last 1 | select -expand name $common = " {0} " -f $common $common
source share