How do you write a script that looks through the /etc/passwd
file for two or more users with the same first name and prints those names. Here is what I have so far and it don't seem to work.Can some tell me what I am doing wrong here thanks.
my $f = '/etc/password';
open(F,$f) || die "Can't open passwd file\n$!\n";
while(<F>){
($uname,$password,$uid,$gid,$username,$home,$shell) = split(/:/,$_);
($firstname,$temp)= split(/\s+/$username);
}#end of while
file for two or more users with the same first name and prints those names. Here is what I have so far and it don't seem to work.Can some tell me what I am doing wrong here thanks.
my $f = '/etc/password';
open(F,$f) || die "Can't open passwd file\n$!\n";
while(<F>){
($uname,$password,$uid,$gid,$username,$home,$shell) = split(/:/,$_);
($firstname,$temp)= split(/\s+/$username);
}#end of while