Computing.Net > Forums > Unix > to append the end of a line

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

to append the end of a line

Reply to Message Icon

Name: Prasad
Date: March 26, 2004 at 17:07:54 Pacific
OS: unix
CPU/Ram: not sure
Comment:

hi all
I need some help and i hope someone can help me..
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
can anyone help me plz regarding this

thanx



Sponsored Link
Ads by Google

Response Number 1
Name: Dlonra
Date: March 26, 2004 at 18:24:10 Pacific
Reply:

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.



0

Response Number 2
Name: cbailey33
Date: March 28, 2004 at 17:40:55 Pacific
Reply:


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


CAB


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: to append the end of a line

Inserting a string at the end of a www.computing.net/answers/unix/inserting-a-string-at-the-end-of-a-/6205.html

To read the value of a variable www.computing.net/answers/unix/to-read-the-value-of-a-variable/5570.html

how to identify the size of a file www.computing.net/answers/unix/how-to-identify-the-size-of-a-file-/7523.html