punklrokk has asked for the wisdom of the Perl Monks concerning the following question:
I have the following code:
and the following data:$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"; }
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:-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
I need to just print out say: ".375 X .049 ROD" instead ofC:\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
Can any of the monks help me please? Your time is much appreciated!!1 .375 X .049 ROD"
JP Bourget (punklrokk) MS Information and Security Rochester Institute of Technology Rochester, NY
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: printing hash values, (don't need the keys)
by philcrow (Priest) on Jul 06, 2006 at 20:40 UTC | |
by punklrokk (Scribe) on Jul 06, 2006 at 20:52 UTC | |
Re: printing hash values, (don't need the keys)
by planetscape (Chancellor) on Jul 06, 2006 at 20:53 UTC | |
Re: printing hash values, (don't need the keys)
by trammell (Priest) on Jul 06, 2006 at 22:07 UTC | |
by GrandFather (Saint) on Jul 06, 2006 at 22:32 UTC | |
Re: printing hash values, (don't need the keys)
by clinton (Priest) on Jul 06, 2006 at 22:41 UTC | |
Re: printing hash values, (don't need the keys)
by ww (Archbishop) on Jul 06, 2006 at 20:34 UTC |