Brian Silverman | 86c8feb | 2014-01-18 17:41:33 -0800 | [diff] [blame] | 1 | #!/usr/bin/env ruby |
2 | |||||
3 | ElementRegex = /[ \t]*(Element[\[(].+) "(.*)" "(.*)" "(.*)" (.*)/ | ||||
4 | |||||
5 | File.open('cape.pcb') do |f| | ||||
6 | $start_lines = f.readlines | ||||
7 | end | ||||
8 | |||||
9 | File.open('cape.pcb', 'w') do |f| | ||||
10 | $start_lines.each do |line| | ||||
11 | match = ElementRegex.match(line) | ||||
12 | if match | ||||
13 | footprint = match[2] | ||||
14 | refdes = match[3] | ||||
15 | f.puts "#{match[1]} \"#{footprint}\" \"#{refdes}\" \"\" #{match[5]}" | ||||
16 | else | ||||
17 | f.puts line | ||||
18 | end | ||||
19 | end | ||||
20 | end |