in reply to How can group these strings

The problem is that you are reading line by line (-p), but want to apply a regexp on multiple lines.

Pick another delimiter. Perhaps you want the -0777 command line switch (but I don't know what else is in the file text)