aoc2022/d21/draw.awk

10 lines
220 B
Awk

BEGIN { print "digraph G {"}
{ k = substr($1,1,length($1)-1) }
NF == 2 { print k, "[label=\"" $0 "\"];" }
NF == 4 {
print k, "[label=\"" k " " $3 "\"];"
print k, "->", $2, ";"
print k, "->", $4, ";"
}
END { print "}" }