script for extracting parts from a design to put in preferred parts db
authorBdale Garbee <bdale@gag.com>
Wed, 14 Oct 2015 20:15:02 +0000 (14:15 -0600)
committerBdale Garbee <bdale@gag.com>
Wed, 14 Oct 2015 20:15:02 +0000 (14:15 -0600)
bin/extract-board-parts [new file with mode: 0755]

diff --git a/bin/extract-board-parts b/bin/extract-board-parts
new file mode 100755 (executable)
index 0000000..f490972
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+# extract parts from a gEDA schematic for addition to preferred parts database
+# Copyright 2015 Bdale Garbee <bdale@gag.com>, GPLv3+
+# assumes attribs file contents like:
+#      device
+#      value
+#      footprint
+#      loadstatus
+#      provided
+#      mfg_part_number
+#      vendor
+#      vendor_part_number
+
+gnetlist -g bom -o - $1.sch \
+       | head -1 \
+       | awk '{ printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", $2, $3, $4, $5, $6, $7, $8, $9) }' 
+
+gnetlist -g bom -o - $1.sch \
+       | tail -n +2 \
+       | awk '{ printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", $2, $3, $4, $5, "no", $7, $8, $9) }' \
+       | sort | uniq
+