Downgrade kicad_pcb to stable from nightly?

Has anyone come across a script or plugin to do this?

I’ve done it a few times by hand, and once with grep/sed, but for some reason I didn’t bother to save my commands and now I want to again…

Might want to at least post what is your OS. The process will vary quite a bit depending on package manager and other things.

linux but I’ll even boot up windows if there’s something already written…

Ah sorry, I misunderstood your issue as “downgrade to stable version” instead of downgrade file format of pcb.

My tactic for this is completely manual, try to open the file, remove whatever 5.1.7 complains about, repeat until it works.

ok, so this will do most of it. just need to remove defaults and stackup sections manually, I’m too lazy/bad at regex to figure out those.

cat nightly.kicad_pcb | sed -r "s/\(tstamp [^\)]*\)//" | sed -r "s/\(pinfunction [^\)]*\)//" > stable.kicad_pcb

1 Like

Sorry, I have a compulsion to optimise shell commands.

sed -r -e "s/\(tstamp [^\)]*\)//" -e "s/\(pinfunction [^\)]*\)//" nightly.kicad_pcb > stable.kicad_pcb

If having the input file deeper in the line bothers you, you can put it up front like this. Heck, let’s put the output file up front too.

< nightly.kicad_pcb > stable.kicad_pcb sed -r -e "s/\(tstamp [^\)]*\)//" -e "s/\(pinfunction [^\)]*\)//"


hmm, sounds like you might know how to balance parens… I need to detect (defaults (...)(...)(...)) to do the rest automatically

Regexes (= (N)DFSAs) cannot count. You need a more powerful construct.

Hmm maybe time to fire up python and learn what s-expr actually are

In case it’s useful, here’s an old snippet that I was using to compare sexpr netlists…

I also have a simple parser here

Here’s one that can be installed with pip:

Some implementations may have a more suitable interface for the operations you want.