Hi,
I have to combine several Unix password files and remove any duplicate
accounts - putting this into LDAP.
I have the following code that will remove any duplicate whole lines but
I need to remove lines only if the first field of the password file is a
duplicate.
---------------------
use strict;
use warnings;
my $passwdfile = "pwcomb";
my %seen = ();
{
local @ARGV = ($passwdfile);
local $^I = '.bac';
while(<>){
$seen{$_}++;
next if $seen{$_} > 1;
print;
}
}
print "finished";
---------------------
Could someone help with a solution to this?
Thanks,
Greg.