I'm trying to take an error file and summarize the results. Counting the number of errors per cell by error type.
Example input format:
SELECT Error1
COMMENT = "blah blah blah"} (4;76)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Structure ( lower left x, y ) ( upper right x, y )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cellx05 (0.98000, 1.08000) (0.98000, 1.18000)
cellx05 (1.12000, 1.08000) (1.12000, 1.18000)
cellx90 (2.32000, 1.39000) (2.40000, 1.39000)
cellx90 (2.32000, 1.53000) (2.40000, 1.53000)
SELECT Error2
COMMENT = "yada yada yada"} (4;76)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Structure ( lower left x, y ) ( upper right x, y )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cellx05 (0.98000, 1.08000) (0.98000, 1.18000)
cellx90 (1.12000, 1.08000) (1.12000, 1.18000)
cellx90 (2.32000, 1.39000) (2.40000, 1.39000)
cellx90 (2.32000, 1.53000) (2.40000, 1.53000)
Each time a cell is listed equals one error.
I would like the output summarized as:
Cell Error1 Error2
cellx05 2 1
cellx90 2 3
I'm thinking that the way I'm going about this is all wrong, but as this is about my 5th attempt, I thought I would beg some help from the experts.
My code is as follows, I haven't even attempted to code the output portion:
$errorfile = "allcells.err";
open (IF, $errorfile) || die ("ERROR: Cannot open file: $!\n"
;
%Err1;
%Err2;
while (<IF>) {
if ($_ =~/SELECT\b (Error1|Error2)\b/){
my($errtype)=$1;
if ($_ =~ /(cell[\S]+)/ {
my($cell) = $1;
$Err1{$cell}++ if($errtype eq 'iError1');
$Err2{$cell}++ if($errtype eq 'Error2');
}
}
close <IF>;
}
Example input format:
SELECT Error1
COMMENT = "blah blah blah"} (4;76)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Structure ( lower left x, y ) ( upper right x, y )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cellx05 (0.98000, 1.08000) (0.98000, 1.18000)
cellx05 (1.12000, 1.08000) (1.12000, 1.18000)
cellx90 (2.32000, 1.39000) (2.40000, 1.39000)
cellx90 (2.32000, 1.53000) (2.40000, 1.53000)
SELECT Error2
COMMENT = "yada yada yada"} (4;76)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Structure ( lower left x, y ) ( upper right x, y )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cellx05 (0.98000, 1.08000) (0.98000, 1.18000)
cellx90 (1.12000, 1.08000) (1.12000, 1.18000)
cellx90 (2.32000, 1.39000) (2.40000, 1.39000)
cellx90 (2.32000, 1.53000) (2.40000, 1.53000)
Each time a cell is listed equals one error.
I would like the output summarized as:
Cell Error1 Error2
cellx05 2 1
cellx90 2 3
I'm thinking that the way I'm going about this is all wrong, but as this is about my 5th attempt, I thought I would beg some help from the experts.
My code is as follows, I haven't even attempted to code the output portion:
$errorfile = "allcells.err";
open (IF, $errorfile) || die ("ERROR: Cannot open file: $!\n"

%Err1;
%Err2;
while (<IF>) {
if ($_ =~/SELECT\b (Error1|Error2)\b/){
my($errtype)=$1;
if ($_ =~ /(cell[\S]+)/ {
my($cell) = $1;
$Err1{$cell}++ if($errtype eq 'iError1');
$Err2{$cell}++ if($errtype eq 'Error2');
}
}
close <IF>;
}