To Append the End of a Line

In /etc/group file I need to append usernames at the end of a group record so that these users will also belong to that group.
that is
in /etc/group file
if the records r like
group1:x:102:
group2:x:103:
.
.
I need to find the line where group2 is present and append usernames like

group2:x:103:user1 user2 user3

so that these users also belong to group2

---->
ex /etc/group<<!
g/^group2:/s/$/user1 user2 user3/
w
q
!
Of course, backup /etc/group.

However, I vaguely recall there is a group maintenance command -which is the correct way of doing this.

---->
usermod -G <group to add> <user login>

CAB

See Also
Unix Administrator Career Path

Have a Unix Problem
Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.