I created this for you so you have something you can start playing with. I think it already does what you want. It works by creating a hash with keys and it depends on the fact that a hash key has to be unique and you can use 'exists' to see if the key already exists.

use strict ; use warnings ; while(<DATA>) { chomp ; my @values = split(',', $_) ; # print "values = @values\n" ; processKey( @values ) ; } my $foundKeys = {} ; sub processKey { my $key = $_[0] ; my $col2 = $_[1] ; my $col3 = $_[2] ; my $col4 = $_[3] ; my $col5 = $_[4] ; my $col6 = $_[5] ; if ( exists $foundKeys->{ $key } ) { # skip } else { $foundKeys->{ $key } = 1 ; print "$key $col2 $col3 $col4 $col5 $col6\n" ; } } __DATA__ key_683,march,29031990,ABCD_FH,9,9 key_684,march,29031990,ABCD_FH,9,9 key_685,march,29031990,ABCD_FH,9,9 key_686,march,29031990,ABCD_FH,9,9 key_687,march,29031990,ABCD_FH,9,9 key_688,march,29031990,ABCD_FH,9,9 key_689,march,29031990,ABCD_FH,9,9 key_693,march,29031990,ABCD_FH,9,9 key_694,march,29031990,ABCD_FH,9,9 key_683,march,29031990,ABCD_H + ABC_F,8,17 key_684,march,29031990,ABCD_H + ABC_F,8,17 key_685,march,29031990,ABCD_H + ABC_F,8,17 key_686,march,29031990,ABCD_H + ABC_F,8,17 key_687,march,29031990,ABCD_H + ABC_F,8,17 key_688,march,29031990,ABCD_H + ABC_F,8,17 key_689,march,29031990,ABCD_H + ABC_F,8,17 key_690,march,29031990,ABCD_H + ABC_F,8,17 key_691,march,29031990,ABCD_H + ABC_F,8,17 key_692,march,29031990,ABCD_H + ABC_F,8,17 key_693,march,29031990,ABCD_H + ABC_F,8,17 key_694,march,29031990,ABCD_H + ABC_F,8,17 key_695,march,29031990,ABCD_H + ABC_F,8,17 key_696,march,29031990,ABCD_H + ABC_F,8,17 key_697,march,29031990,ABCD_H + ABC_F,8,17 key_698,march,29031990,ABCD_H + ABC_F,8,17 key_699,march,29031990,ABCD_H + ABC_F,8,17 key_683,march,29031990,ABC_H + AB_F,2,19 key_684,march,29031990,ABC_H + AB_F,2,19 key_685,march,29031990,ABC_H + AB_F,2,19 key_686,march,29031990,ABC_H + AB_F,2,19 key_687,march,29031990,ABC_H + AB_F,2,19 key_688,march,29031990,ABC_H + AB_F,2,19 key_689,march,29031990,ABC_H + AB_F,2,19 key_690,march,29031990,ABC_H + AB_F,2,19 key_691,march,29031990,ABC_H + AB_F,2,19 key_692,march,29031990,ABC_H + AB_F,2,19 key_693,march,29031990,ABC_H + AB_F,2,19 key_694,march,29031990,ABC_H + AB_F,2,19 key_695,march,29031990,ABC_H + AB_F,2,19 key_696,march,29031990,ABC_H + AB_F,2,19 key_697,march,29031990,ABC_H + AB_F,2,19 key_698,march,29031990,ABC_H + AB_F,2,19 key_699,march,29031990,ABC_H + AB_F,2,19 key_700,march,29031990,ABC_H + AB_F,2,19 key_701,march,29031990,ABC_H + AB_F,2,19

In reply to Re: I want to remove duplicate based on specific column and value. by Veltro
in thread I want to remove duplicate based on specific column and value. by EBK

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.