in reply to Re^3: how to change this code into perl
in thread how to change this code into perl
Hi poj, thank you for the quick response, I tried the script and could not get the duplicate rows, the outcome came up with zero rows. below is the script i tried
open IN,'<','/home/scripts/imageoutcome.txt' or die "Could not open $i +nfile : $!"; my %count = (); my @lines = (); while (<IN>){ push @lines,$_; # print $_; if (/^(\S+)/){ ++$count{$1}; } } close IN; open OUT,'>','/home/scripts/outcome.txt' or die "Could not open $outfi +le : $!"; #print @lines; for (@lines){ if (/^(\S+)/){ print $count{$1}; print OUT $_ if $count{$1} > 0; } } close OUT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: how to change this code into perl
by poj (Abbot) on Aug 30, 2015 at 19:15 UTC | |
by perlnewbie012215 (Novice) on Aug 30, 2015 at 20:16 UTC |