open (my $INPUT, '<', 'bodo.txt'); open (my $OUTPUT, '>', 'output.txt'); my %seen; while (<$INPUT>) { my $line = $_; $line =~ /\A\D+(\d+)\D+(\d+)/; print $OUTPUT $line unless (defined($seen{"$1\t$2"}) and $line ne +"\n"); $seen{"$1\t$2"}++; }
Not really clever, but pretty clean and hopefully easy to follow. I used $1\t\$2 as the key for %seen as I didn't think you wanted to Blah 83 Blah 90 to prevent Blah 8 Blah 390 from printing. Also wasn't sure if you wanted to keep the blank lines in there or not but thought I'd keep them. Could optimize the regex but prob would need better information on the dataset etc...
Update: Also wanted to point out that you are assuming that the line of data will be unique against the numerical values in it. You could check store the line per unique value sets and then check for variations to see if it's been added. If that is how you need to go let us know cause we'll have to tweak our solutions for you.

In reply to Re: delete redundant data by MajingaZ
in thread delete redundant data by nurulnad

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.