-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathged2dot.pl
More file actions
executable file
·35 lines (35 loc) · 862 Bytes
/
ged2dot.pl
File metadata and controls
executable file
·35 lines (35 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl
#
# creates a simple (Graphviz) .dot file from a GEDCOM file
# input : STDIN ; output : STDOUT
# usage is './ged2dot.pl < x.ged > x.dot'
# or './ged2dot.pl < x.ged |dot -Tps -o x.ps'
# (when converting to .pdf, use 'identify x.ps
# and ps2pdf -dDEVICEWIDTHPOINTS=2800 -dDEVICEHEIGHTPOINTS=1024 x.ps x.pdf'
#
sub wash{ # removes '@' from node names
my $x = $_[0];
$x =~ s/\@//g;
return($x);
}
print "digraph G {\n";
while ($line = <STDIN>)
{
if ($line =~ /^0 (.*) INDI/)
{
$node_indi = wash($1);
}
if ($line =~ /^1 NAME (.*?) .*\/(.*)\//)
{ # 1 NAME James Dewey /Watson/ --> James Watson
print " $node_indi [label=\"$1 $2\"]\n";
}
if ($line =~ /^1 FAMC (.*)$/)
{
printf(" %s -> %s\n", wash($1), $node_indi);
}
if ($line =~ /^1 FAMS (.*)$/)
{
printf(" %s -> %s\n", $node_indi, wash($1));
}
}
print "}\n";