Hello

I have the following code:

$data_file="ActiveItems2.txt"; open(DAT, $data_file) || die("Could not open file!"); @raw_data=<DAT>; close(DAT); my %uniques; foreach my $key(@raw_data){ $uniques{$key}++; } foreach $line(%uniques){ print "$line \n"; }
and the following data:

-331816 -331816 .25 X 10.25 X 17 .25 X 10.25 X 17 .250 ROLL #3 CUT .250 ROLL #3 CUT .250 SOLID ROD .250 SOLID ROD .250 SOLID ROD .375 ROLL #3 CUT .375 ROLL #3 CUT .375 X .049 ROD .375 X .049 ROD .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS .437 DIA 1018 CRS
My problem is I really have a 200,000+ line file in which I need to remove the duplicates and then print them. I am unable to figure out how to only output the original line, with out a count of how many there were such as:
C:\scripts>jr2.pl .250 ROLL #3 CUT 2 .250 SOLID ROD 3 -331816 2 .25 X 10.25 X 17 2 .375 ROLL #3 CUT 2 .437 DIA 1018 CRS 15 .437 DIA 1018 CRS 1 .375 X .049 ROD 2
I need to just print out say: ".375 X .049 ROD" instead of
1 .375 X .049 ROD"
Can any of the monks help me please? Your time is much appreciated!!

JP Bourget (punklrokk) MS Information and Security Rochester Institute of Technology Rochester, NY


In reply to printing hash values, (don't need the keys) by punklrokk

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.