# Symbol counter # by C. Masloch, 2019 # # Usage of the works is permitted provided that this # instrument is retained with the works, so that any entity # that uses the works is notified of this instrument. # # DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY. 5007 [2019-03-31 16:19:46 +0200 Mar Sun] perl -e '$lines = 0; $length = 0; while (<>) { if ($_ =~ s/^\s*[0-9A-Fa-f]+\s+[0-9A-Fa-f]+\s+(\S+)$/$1/) { $length += length ($_) + 2; $lines += 1; }; }; printf "Lines:\t\t%u\nLength:\t\t%u\nAverage:\t%u\n", $lines, $length, $length / $lines;' lDOSLOAD.MAP 5013 [2019-03-31 21:32:55 +0200 Mar Sun] perl -e '$max = 0; $lines = 0; $length = 0; while (<>) { if ($_ =~ s/^\s*[0-9A-Fa-f]+\s+[0-9A-Fa-f]+\s+(\S+)$/$1/) { $itemlength = length ($_) + 2; if ($itemlength > $max) { $max = $itemlength; }; $length += $itemlength; $lines += 1; }; }; printf "Lines:\t\t%u\nLength:\t\t%u\nAverage:\t%u\nLongest:\t%u\n", $lines, $length, $length / $lines, $max;' lDOSLOAD.MAP 5088 [2019-04-01 22:37:11 +0200 Apr Mon] perl -e '$max = 0; $maxlabel = ""; $lines = 0; $length = 0; @results = (); while (<>) { if ($_ =~ s/^\s*[0-9A-Fa-f]+\s+[0-9A-Fa-f]+\s+(\S+)\n*$/$1/) { $hash = 1; $string = $label = $_; while ($string =~ s/^(.)(.*)$/$2/) { $hash = ($hash * 31 + ord ($1)) & 0xFFFF; }; push @{ $results[$hash] }, $label; $itemlength = length ($_) + 2; if ($itemlength > $max) { $max = $itemlength; $maxlabel = $_; }; $length += $itemlength; $lines += 1; }; }; printf "Lines:\t\t%u\nLength:\t\t%u\nAverage:\t%u\nLongest:\t%u\n %s\n", $lines, $length, $length / $lines, $max, $maxlabel; $index = 0; @numbers = (); foreach $names (@results) { $occurrences = scalar(@{ $names }); if (not defined $numbers[$occurrences]) { $numbers[$occurrences] = 1 } else { $numbers[$occurrences] += 1; }; if (defined $names and $occurrences > 2) { printf "%04Xh", $index; foreach $name (@$names) { printf " %s", $name}; printf "\n"; }; $index += 1; }; $index = 0; foreach $number (@numbers) { print $index." ".$number."\n"; $index += 1; };' lDOSLOAD.MAP 5095 [2019-04-01 22:45:43 +0200 Apr Mon] perl -e '$max = 0; $maxlabel = ""; $lines = 0; $length = 0; @results = (); while (<>) { if ($_ =~ s/^\s*[0-9A-Fa-f]+\s+[0-9A-Fa-f]+\s+(\S+)\n*$/$1/) { $hash = 1; $string = $label = $_; while ($string =~ s/^(.)(.*)$/$2/) { $hash = ($hash * 31 + ord ($1)) & 0xFFFF; }; push @{ $results[$hash] }, $label; $itemlength = length ($_) + 2; if ($itemlength > $max) { $max = $itemlength; $maxlabel = $_; }; $length += $itemlength; $lines += 1; }; }; printf "Lines:\t\t%u\nLength:\t\t%u\nAverage:\t%u\nLongest:\t%u\n %s\n", $lines, $length, $length / $lines, $max, $maxlabel; $index = 0; @numbers = (); foreach $names (@results) { $occurrences = scalar(@{ $names }); if (not defined $numbers[$occurrences]) { $numbers[$occurrences] = 1 } else { $numbers[$occurrences] += 1; }; if (defined $names and $occurrences > 2) { printf "%04Xh", $index; foreach $name (@$names) { printf " %s", $name}; printf "\n"; }; $index += 1; }; $index = 0; foreach $number (@numbers) { print $index." ".($number or 0)."\n"; $index += 1; };' lDOSLOAD.MAP 5255 [2019-04-04 22:50:28 +0200 Apr Thu] perl -e '$maxoccurrences = 2; $hashmask = 0xFFFF; $max = 0; $maxlabel = ""; $lines = 0; $length = 0; @results = (); while (<>) { if ($_ =~ s/^\s*[0-9A-Fa-f]+\s+[0-9A-Fa-f]+\s+(\S+)\n*$/$1/) { $hash = 1; $string = $label = $_; while ($string =~ s/^(.)(.*)$/$2/) { $hash = ($hash * 31 + ord ($1)) & $hashmask; }; push @{ $results[$hash] }, $label; $itemlength = length ($_) + 2; if ($itemlength > $max) { $max = $itemlength; $maxlabel = $_; }; $length += $itemlength; $lines += 1; }; }; printf "Lines:\t\t%u\nLength:\t\t%u\nAverage:\t%u\nLongest:\t%u\n %s\n", $lines, $length, $length / $lines, $max, $maxlabel; $index = 0; @numbers = (); $results[0xFFFF] = (); foreach $names (@results) { $occurrences = scalar(@{ $names }); if (not defined $numbers[$occurrences]) { $numbers[$occurrences] = 1 } else { $numbers[$occurrences] += 1; }; if (defined $names and $occurrences > $maxoccurrences) { printf "%04Xh", $index; foreach $name (@$names) { printf " %s", $name}; printf "\n"; }; $index += 1; }; $index = 0; foreach $number (@numbers) { print $index." ".($number or 0)."\n"; $index += 1; };' lDOSLOAD.MAP 5263 [2019-04-04 22:57:13 +0200 Apr Thu] perl -e '$maxoccurrences = 19; $hashmask = 0xFF; $hashmax = $hashmask; $max = 0; $maxlabel = ""; $lines = 0; $length = 0; @results = (); while (<>) { if ($_ =~ s/^\s*[0-9A-Fa-f]+\s+[0-9A-Fa-f]+\s+(\S+)\n*$/$1/) { $hash = 1; $string = $label = $_; while ($string =~ s/^(.)(.*)$/$2/) { $hash = ($hash * 31 + ord ($1)) & $hashmask; }; push @{ $results[$hash] }, $label; $itemlength = length ($_) + 2; if ($itemlength > $max) { $max = $itemlength; $maxlabel = $_; }; $length += $itemlength; $lines += 1; }; }; printf "Lines:\t\t%u\nLength:\t\t%u\nAverage:\t%u\nLongest:\t%u\n %s\n", $lines, $length, $length / $lines, $max, $maxlabel; $index = 0; @numbers = (); $results[$hashmax] = (); foreach $names (@results) { $occurrences = scalar(@{ $names }); if (not defined $numbers[$occurrences]) { $numbers[$occurrences] = 1 } else { $numbers[$occurrences] += 1; }; if (defined $names and $occurrences > $maxoccurrences) { printf "%04Xh", $index; foreach $name (@$names) { printf " %s", $name}; printf "\n"; }; $index += 1; }; $index = 0; foreach $number (@numbers) { print $index." ".($number or 0)."\n"; $index += 1; };' lDOSLOAD.MAP 5273 [2019-04-04 23:03:48 +0200 Apr Thu] perl -e '$maxoccurrences = 19; $hashmask = 0xFF; $hashmax = $hashmask; $max = 0; $maxlabel = ""; $lines = 0; $length = 0; @results = (); while (<>) { if ($_ =~ s/^\s*[0-9A-Fa-f]+\s+[0-9A-Fa-f]+\s+(\S+)\n*$/$1/) { $hash = 1; $string = $label = $_; while ($string =~ s/^(.)(.*)$/$2/) { $hash = ($hash * 31 + ord ($1)) & $hashmask; }; push @{ $results[$hash] }, $label; $itemlength = length ($_) + 2; if ($itemlength > $max) { $max = $itemlength; $maxlabel = $_; }; $length += $itemlength; $lines += 1; }; }; printf "Lines:\t\t%u\nLength:\t\t%u\nAverage:\t%u\nLongest:\t%u\n %s\n", $lines, $length, $length / $lines, $max, $maxlabel; $index = 0; @numbers = (); $results[$hashmax] = (); foreach $names (@results) { $occurrences = scalar(@{ $names }); if (not defined $numbers[$occurrences]) { $numbers[$occurrences] = 1 } else { $numbers[$occurrences] += 1; }; if (defined $names and $occurrences > $maxoccurrences) { printf "%04Xh", $index; foreach $name (@$names) { printf " %s", $name}; printf "\n"; }; $index += 1; }; $index = 0; $sum = 0; foreach $number (@numbers) { $n = ($number or 0); $sum += $n; print $index." ".$n."\n"; $index += 1; }; print "Sum: ".$sum."\n";' lDOSLOAD.MAP 5291 [2019-04-04 23:29:34 +0200 Apr Thu] perl -e '$examine = 1000; $maxoccurrences = 19; $hashmask = 0xFF; $hashmax = $hashmask; $max = 0; $maxlabel = ""; $lines = 0; $length = 0; @results = (); $results[$hashmax] = (); while (<>) { if ($_ =~ s/^\s*[0-9A-Fa-f]+\s+[0-9A-Fa-f]+\s+(\S+)\n*$/$1/) { $hash = 1; $string = $label = $_; while ($string =~ s/^(.)(.*)$/$2/) { $hash = ($hash * 31 + ord ($1)) & $hashmask; }; push @{ $results[$hash] }, $label; $itemlength = length ($_) + 2; if ($itemlength > $max) { $max = $itemlength; $maxlabel = $_; }; $length += $itemlength; $lines += 1; }; }; printf "Lines:\t\t%u\nLength:\t\t%u\nAverage:\t%u\nLongest:\t%u\n %s\n", $lines, $length, $length / $lines, $max, $maxlabel; $index = 0; @numbers = (); foreach $names (@results) { $occurrences = scalar(@{ $names }); if (not defined $numbers[$occurrences]) { $numbers[$occurrences] = 1 } else { $numbers[$occurrences] += 1; }; if (defined $names and ($occurrences > $maxoccurrences or $occurrences == $examine)) { printf "%04Xh", $index; foreach $name (@$names) { printf " %s", $name}; printf "\n"; }; $index += 1; }; $index = 0; $sum = 0; foreach $number (@numbers) { $n = ($number or 0); $sum += $n; print $index." ".$n."\n"; $index += 1; }; print "Sum: ".$sum."\n";' lDOSLOAD.MAP | grep -Ev "^[0-9]+ [0-9]+s$"