1 # expand tab-separated partslist, replacing unknown fields with data
2 # from preferred parts list
4 # Copyright 2015 by Bdale Garbee <bdale@gag.com>, GPL v3
7 PARTFILE = "../altusmetrum/preferred-parts"
9 while (getline <PARTFILE > 0) {
11 parts[$1, $2, $3] = $0
16 printf "%s\t%s\t%s\t%s", $1, $2, $3, $4
17 split(parts[$2,$3,$4],field,"\t")
19 if ( $5 == "unknown") printf "\t%s", field[4]
20 else printf "\t%s", $5
22 if ( $6 == "unknown") printf "\t%s", field[5]
23 else printf "\t%s", $6
25 if ( $7 == "unknown") printf "\t%s", field[6]
26 else printf "\t%s", $7
28 if ( $8 == "unknown") printf "\t%s", field[7]
29 else printf "\t%s", $8
31 if ( $9 == "unknown") printf "\t%s", field[8]
32 else printf "\t%s", $9