HI Frank,

You can use this one :

#!/usr/local/bin/perl

my $file = "/etc/passwd";
my $temppwfile = "/etc/tmppasswd";

$teller = 5000;
open(PW, "< $file");
open(NEWPW, ">$temppwfile");

while (<PW>) {
 ($user, $pw, $uid, $grpid, $descr, $home, $shell) = split(/:/);
 $newline = "${user}:${pw}:${teller}:${grpid}:${descr}:${home}:${shell}";
 print NEWPW $newline;
 $teller++;
}
close(PW);
close(NEWPW);

Make sure you don't overwrite him at once, please first check the new file !!!
You off course can only do this as root. Preferably I would be making a copy of the 
/etc/passwd-file first and work with that.
Be aware of a possible (last)NIS-entry(s), those doesn't need a >5000 number in it's 
entry. And make sure to not change the "lp, root, adm, etc.." That will make your life 
real hard you see.
Good luck, and be carefull !! (it is tested)

Regs David
-----------------
> 
> Hi
> 
> I need a script that modify the UID field in a /etc/passwd file 
> for UNIX
> 
> the purpose is to change the existing UID field from a start number (Eg 5000 )
> for the first line then do UID + 1 for the next line etc etc until EOF
> 
> Thanks
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to