This may be of interest to some. I wrote a Perl script to count the number of units of each type in a save game file. It also counts the types in the EDU file as a side effect.

To run it, you need perl installed (www.perl.com).

EXAMPLE: This is the census of all units at the beginning of a BI game that I saved as saxons.sav. I got this output by running the script and entering the savegame name when asked for it.

Code:
There are  210 units defined in bi/data/export_descr_unit.txt

ENTER NAME OF SAVE FILEsaxons.sav
african peasant = 2
alan horse archers = 2
alemanni warhounds = 1
axe heerbann = 1
berber axemen = 2
berber lancers = 1
bucellarii = 2
burgundian lancer = 3
camel raiders = 3
celtic slingers = 1
celtic spearman = 1
celtic warlord = 2
celtish wolfhounds = 1
chosen warlord alemanni = 8
clibinarii = 4
clibinarii immortals = 3
comitatenses = 31
desert archers african = 1
desert archers sassanid = 4
desert cavalry = 2
desert chieftain = 2
eastern archer = 12
equites auxilia = 1
foederati cavalry = 19
foederati infantry = 14
frankish paladin bodyguard = 2
gallowglass = 1
goth raiders = 1
goth warlords = 2
gothic lancer = 1
gothic spearmen = 2
herdsmen sarmatian = 5
hillmen = 1
hippo toxotai = 7
hun horde chosen warriors = 31
hun horde horse = 32
hun horde peasants = 28
hun horde spearmen = 36
hunnic elite warriors = 1
hunnic heavy cavalry = 1
hunnic lancers = 3
hunnic warlords = 4
imperial german bodyguard = 19
imperial household bodyguard = 16
kurdish javelinmen = 2
legio lanciarii = 6
levy spearman frank = 3
levy spearman saxon = 1
levy spearmen sassanid = 18
limitanei = 68
lombard archers = 6
merc alan horse archers = 4
merc alan noble cavalry = 1
merc armoured camel riders = 4
merc ballistae = 4
merc bosphoran infantry = 1
merc bucellarii = 7
merc camel raiders = 5
merc elephants = 2
merc equites veteranii = 10
merc foederati cavalry = 2
merc foederati infantry = 2
merc gallowglass = 1
merc golden band = 2
merc graal knights = 2
merc hippo toxotai = 6
merc moorish raiders = 1
merc sarmatian armoured archers = 5
merc vandal lancers = 1
merc vandal raiders = 1
merc veteranii = 11
moorish raiders = 2
mountain men = 2
mountain slinger = 5
naval biremes = 10
naval boats = 5
naval corvus quinquireme = 1
naval quinquiremes = 3
naval triremes = 8
nomad archer cavalry = 1
peasant gothic = 1
roman priest = 2
runaway slave spearmen = 9
sarmatian armoured archers = 1
sarmatian auxilia = 2
sarmatian warlords = 5
sassanid peasant = 10
saxon hunters = 6
saxon keels = 1
saxon warlord = 4
scholae palatinae = 1
scotti chariots = 1
spear warband alemanni = 9
steppe horde chosen warriors = 12
steppe horde horse = 36
steppe horde peasants = 24
steppe horde spearmen = 24
steppe horse archers = 5
steppe lancers = 5
steppe raiders = 14
steppe spearmen vandal = 2
steppe warlords = 5
tribal cavalry = 2
western archer = 21
western peasant = 2
western peasant alemanni = 4
western peasant celt = 1
western peasant frank = 1
western peasant saxon = 1
HIT ENTER TO EXIT

The script code follows (save this as a text file with the name units.pl . You must associate the .pl extension with the Perl application to make it run). The script also generates a file that lists all the units and their counts. The file is saved in the same folder as the script. The script refers to the default location of the TW executables. If you have them installed elsewhere, edit the $tw_path variable at the top of the script.

Enjoy!
Code:
#!usr/bin/perl

$unitsfile="export_descr_unit.txt";
$buildings="export_descr_buildings.txt";

$bi_saves="bi/saves/";
$tw_path = 'C:/Program Files/Activision/Rome - Total War/';											
$bi_data="bi/data/";


$fn=$tw_path.$bi_data.$unitsfile;

open (FIL, '<', $fn ) or die "cannot open units file $!";
@lines=<FIL>;
close FIL;

foreach $line (@lines) { push @units, $line =~ m/^type\s+(\w.*)$/;};  #match unit type to beginning of line followed the word type then whitespace and collect the unit name in @units

$count=@units;
@units= sort @units;

print "There are  $count units defined in $bi_data$unitsfile\n\n";

print "ENTER NAME OF SAVE FILE";

$savefile=<STDIN>;
chomp($savefile);

$fn=$tw_path.$bi_saves.$savefile;
open ( FIL,'<', $fn)					or die "Can't open $!";
binmode FIL;

while (read(FIL,$buf,200000))				#read 200K at a time. 
{
 	@ascii=  $buf =~/[\w ]{5,}/g ;			#match all that look like names. 
	push @names,@ascii;						#collect them.
}
close (FIL);



%counts;										#hash to count
for (@names) {$counts{$_}++;}; 				#hash contains names as keys with counts as values.


$dest=$savefile.".unitcounts.txt";

open (TO , '>', $dest);
for (@units)
{

 print TO  $_," = ", $counts{$_},"\n";
 if ($counts{$_}) { print $_, " = ", $counts{$_},"\n";};
};

close (TO);

print "HIT ENTER TO EXIT";
<STDIN>;
DISCLAIMER: I'm still learning to write perl, so I'm sorry for the messy code.