X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=bibliofile%2Fparse_dbd.pl;fp=bibliofile%2Fparse_dbd.pl;h=938a52c8cbd48483de361e72759679e2c02d9ffd;hp=f72347c48e5c803599ca6bb77b71814480c7b5a1;hb=b9de04f1f1121aedf8ad9db34c1952c57b9dbf0c;hpb=e657089751e935005c4338f0cd1b7d52074abac3 diff --git a/bibliofile/parse_dbd.pl b/bibliofile/parse_dbd.pl index f72347c..938a52c 100755 --- a/bibliofile/parse_dbd.pl +++ b/bibliofile/parse_dbd.pl @@ -14,7 +14,7 @@ my $startOfColumnTypes = 8; while (<>) { my $dbd = $_; - my $rowlength = ord substr($dbd, 0, 1); + my $rowlength = ord(substr($dbd, 0, 1)) + (256 * (ord(substr($dbd, 1, 1)))); my $numcolumns = ord substr($dbd, 2, 1); my $extra = sprintf( "%02x %02x %02x", @@ -30,15 +30,15 @@ while (<>) { my $colnames = substr($dbd, $startOfColumnTypes + 7*$numcolumns - 2); my @col = split(/\x00/, $colnames); - #print "Row length: $rowlength\n"; - #print "Columns: $numcolumns\n"; - #print "Extra data: $extra\n"; - #print "Delimiter: $delimiter\n"; + print "Row length: $rowlength\n"; + print "Columns: $numcolumns\n"; + print "Extra data: $extra\n"; + print "Delimiter: $delimiter\n"; for (my $i = 1; $i <= $numcolumns; $i++) { my $coltype = substr($dbd, 7*($i-1)+$startOfColumnTypes, 1); my $collength = ord substr($dbd, 7*($i-1)+$startOfColumnTypes+1, 1); - printf ("Column %0" . length($numcolumns) . "d: %-8s %s (%d chars)\n", $i, $coltypes{$coltype}, $col[$i-1], $collength); + printf ("Column %02d: %-8s %s (%d chars)\n", $i, $coltypes{$coltype}, $col[$i-1], $collength); } }