If you want all groups known to the system, I would recommend using getent group instead of parsing /etc/group:
***
getent group
***
The reason is that on networked systems, groups may not only read from /etc/group file, but also obtained through LDAP or Yellow Pages (the list of known groups comes from the local group file plus groups received via LDAP or YP in these cases).
If you want just the group names you can use:
***
getent group | cut -d: -f1
***