john.tm has asked for the wisdom of the Perl Monks concerning the following question:
input 1,ken,james,smith,s 11,ken,james,smith,f 0,ken,james,smith,s output 11,ken,james,smith,f
seek $ifh, 0, 0; my @file = <$ifh>; my @array; my %hash; foreach my $_ (reverse @file) { chomp; next if ! m/^\s+\d/; s/^\s+//g; s/\s+$//g; s/\s+/,/g; my $key = join ',', ( split /,/ )[ 1, 2, 3 ]; # remove duplicates +column b,c,d #push @array, $_ print $_, "\n" if ! $hash{$key}++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl to remove duplacate based on columnb,d &
by blindluke (Hermit) on Jan 01, 2015 at 00:08 UTC | |
|
Re: perl to remove duplacate based on columnb,d &
by Anonymous Monk on Jan 01, 2015 at 05:39 UTC |