Anono-monk,
What is your criteria for skipping an entry? You have root, and johnny marked as skip, but you didnt give a reason that it should be skipped.
Otherwise, here is a theoretical solution
First, open your /etc/passwd file, and read it to an array
open (fd, '/etc/passwd') or die $!;
my @CONTENTS = <fd>;
close (fd);
Now that that is done, get each entry except for root, and compare it to the NIS one
sub ypMatchit
{#This does the most work
# I don't know if you want to add root and johnny
# to your new file or not. If you do want them to
# be added, then change the next trwo undef's you
# see to be '0';
return undef if ($_ && 'root');
return undef if ((<i>rules for skipping johnny are enforced</i>));
my $Final = ypmatch($_);
#add any other processing you want to do here
return 0 if ($Final = (SUCCESS));
return undef;
}
my @FINAL = ();
foreach my $CurrentEntry ( @CONTENTS )
{
push @FINAL, $CurrentEntry if( defined(ypMatchit($CurrentEntry)));
}
Now write the final thing out to a file
open (FD, '/etc/newPasswd') or die $!;
foreach (@FINAL) { print FD $_; }
close (FD);
This is all theory by the way, but I think it is a good start (I did somthing similiar several months ago, and this methodology worked.
HTH - Kristofer |