in reply to Password file and NIS check?
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
open (fd, '/etc/passwd') or die $!; my @CONTENTS = <fd>; close (fd);
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))); }
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
|
|---|