Sort groups by line number then by name.

Existing groups will keep their position in /etc/group, and new groups
will be appended at the end of the file in a reproduceable manner.