Can somebody give me some pointers..... I want to take this:

and turn it into this:

I want the list of names that the comment applies to and the comment itself, I cant get my head round how to check if the comment is the same as another comment and if so group it up