So far I have this code:
#!/use/bin/perl -w
$filename = '/etc/passwd';
open(FILE, $filename) or die "Could not read from $filename, program halting.";
while (<FILE>) {
chomp;
($username, $password, $uid, $gid, $uname, $home, $shell) = split(':', $_);
my ($lastname, $firstname) = split(/ /, $uname, 2);
}
close FILE;
But now I am stuck with what to do next. My rational at the time was to split up the 7 values on the /etc/passwd file at do a match to see how many $lastnames had 5-10 matches, but then I would not know what the associated $username is with them.
For my final output I need to have a list of last names which are shared by 5-10 people so sample output would be something like:
smith : john samantha jared57 dragonx349 6tron39