UNIX Programming, Certification, System Administration, Performance Tuning Reference Books
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

Quick Links:
Do you have a UNIX Question?

Unix Home: Unix System Administration Hints and Tips