Root/hacks/brdclw

Source at commit ebb0d2708b542ee20929375d9a22d37d86b100a5 created 5 years 9 months ago.
By Werner Almesberger, ircstat/README: change date format from MMYY to YYMM
1#!/usr/bin/perl
2#
3# brdclw - Change line width in a specific module in a KiCAD .brd file
4#
5
6sub usage
7{
8    print STDERR "usage: $0 module from to in-file\n";
9    exit(1);
10}
11
12&usage unless @ARGV == 4;
13
14$mod = shift(@ARGV);
15$from = shift(@ARGV);
16$to = shift(@ARGV);
17
18while (<>) {
19    $this = $1 eq $mod if /^\$MODULE\s+(\S+)/;
20    $this = 0 if /^\$EndMODULE/;
21    if ($this && /^DS\s/) {
22        @ds = split(/\s+/);
23        if ($ds[5] == $from) {
24            $ds[5] = $to;
25            $_ = join(" ", @ds)."\n";
26        }
27    }
28    print || die;
29}
30

Archive Download this file

Branches:
master



interactive