Your perl backreferences are incorrect:
perl -lne '$a{$1}++ if (/^(Unexpected exception) : (.*?)\s*$/)
^^^^^^^^^^^^^^^^^^^^^-$1 ^^^^^-$2
You want
$a{$2}++
instead. Or convert that first ()
to a non-capturing group: (?:Un....)
1
solved A perl script to list all the exceptions and their number of occurrence