#!/usr/bin/perl my $argCount = $#ARGV; if (0 != $argCount) { die "usage: dia2svgmult file.dia" ; } my ($diaFileName) = @ARGV; my @layerLines = `gunzip -d -c $diaFileName |grep '<dia:layer'`; my %layerblock2id = (); my @blockIdList; foreach my $layerLine (@layerLines) { chop($layerLine); $layerLine =~ /^[ \t]*<dia:layer name="([^"]+)"/; my $layerId = $1; $layerId =~ /([^0-9]+)([0-9]+)/; my $nonNumeric = $1, $numeric = $2; if ($layerblock2id {$nonNumeric}) { push($layerblock2id {$nonNumeric}, $numeric); } else { $layerblock2id {$nonNumeric} = [$numeric]; push(@blockIdList, $nonNumeric); } } foreach my $layerBlockId (@blockIdList) { my $sublayerIds = $layerblock2id {$layerBlockId}; foreach my $subLayerId (@$sublayerIds) { print $layerBlockId, ":", $subLayerId ,"\n"; } } #end