removing users from /etc/group

removing users from /etc/group

am 13.09.2007 05:57:17 von heylow

Hi Gurus:

I have a master file /etc/group, and another file contains logins
(say, master.login). I want to delete all users in /etc/group, who do
not exist in this master.login

master.login
-----------
abel
dan
cory
sia


/etc/group:
------
gr001:x:500:abel, x,y,z,sia
gr002:x:501:a,b, dan
gr003:x:610:cory, dan, x, a


I wanted to remove users (a, b, x, y, z) who do not exist in
master.login from the /etc/group, so that i can get clean group file.

Thanks for your help.

Pedro.

Re: removing users from /etc/group

am 13.09.2007 08:00:47 von Henry Law

heylow wrote:
> I have a master file /etc/group, and another file contains logins
> (say, master.login). I want to delete all users in /etc/group, who do
> not exist in this master.login

> I wanted to remove users (a, b, x, y, z) who do not exist in
> master.login from the /etc/group, so that i can get clean group file.

You could write some Perl to do that; doesn't look too hard. Why not
have a go and come back here when you hit a snag? People here would be
delighted to help you overcome it.

--

Henry Law Manchester, England

Re: removing users from /etc/group

am 13.09.2007 12:59:54 von Tad McClellan

heylow wrote:

> I have a master file /etc/group, and another file contains logins
> (say, master.login). I want to delete all users in /etc/group, who do
> not exist in this master.login


Start with this FAQ:

perldoc -q intersection

How do I compute the difference of two arrays? How do I compute the
intersection of two arrays?


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"

Re: removing users from /etc/group

am 13.09.2007 22:01:13 von Joe Smith

heylow wrote:

> I wanted to remove users (a, b, x, y, z) who do not exist in
> master.login from the /etc/group, so that i can get clean group file.

That's so easy.

next if not defined $valid_logins{$username};