From 36048db46840289c3ec2e0ba1c8dae21791546c7 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 17 Oct 2010 16:19:49 -0300 Subject: [PATCH] Added more detailed part counting. - boom/count.pl: count characterized parts, with type and manufacturer breakdown - boom/Makefile (count): new target to run count.pl --- boom/Makefile | 5 ++++- boom/count.pl | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 boom/count.pl diff --git a/boom/Makefile b/boom/Makefile index 55a96a1..f4f27e5 100644 --- a/boom/Makefile +++ b/boom/Makefile @@ -16,7 +16,7 @@ DB = $(EQU) $(INV) $(DSC) $(CHR) \ $(DIST:%=dist/%/db/*.dsc) -.PHONY: all show again spotless tar +.PHONY: all show again spotless tar count all: show @@ -41,3 +41,6 @@ spotless: tar: tar cfj boom-db.tar.bz2 $(DB) + +count: + perl ./count.pl $(CHR) diff --git a/boom/count.pl b/boom/count.pl new file mode 100755 index 0000000..ec36cce --- /dev/null +++ b/boom/count.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +$tot = 0; +while (<>) { + next unless /\bT=(.+?)\b/; + $tot++; + $c = $1; + $cat{$c}++; + /^\s*(\S+)\s/; + $man{$c}{$1}++; +} + +print "Total: $tot\n"; +for $c (sort keys %cat) { + print " $c: $cat{$c}\n"; + for $m (sort keys %{ $man{$c} }) { + print "\t$m: $man{$c}{$m}\n"; + } +}