diff options
-rwxr-xr-x | scripts/value_fix.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/value_fix.sh b/scripts/value_fix.sh new file mode 100755 index 0000000..3858401 --- /dev/null +++ b/scripts/value_fix.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# FILE: "/home/evmik/eagle/scripts/value_fix.sh" +# LAST MODIFICATION: "Fri, 18 Jul 2014 16:54:10 -0400 (evmik)" +# (C) 2014 by Eugeniy Mikhailov, <evgmik@gmail.com> +# $Id:$ + + +# Tries to fix eagle schematic to board discrepancy if some one ascendantly changes values in schematic while +# the board file was not connected + +# To avoid gotchas copy the board file into t.brd, it will be edited in place. +# Once you happy with fixes overwrite the original eagle board file with t.brd + +# Look thought the diff and file list of parts with updated values +git diff | grep '+<part name="' |sed s/'+<part name="\([^"]*\)".*value="\([^"]*\).*'/'\1 \2'/ >part.list + +# Now update components values in the board file. +# Assumes that board file is copied into t.brd file +cat part.list | \ +while read part v +do + echo zzz $part zzz $v + sed -i s\z'\(<element name="\)'"$part"'\(".*value="\)[^"]*\(".*\)$'\z'\1'"$part"'\2'"$v"'\3'\z t.brd +done + |