Help needed

hello guys
I was wondering if somebody can help me to write a script that use a ypcat comand to list a gruop of memebers and the passwrod file and I can arrange the output as a following
5 : fac
6 : office
6 : mkl
18 : system
20 : xsystems
21 : guest