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
In reply to printing hash values, (don't need the keys) by punklrokk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |