Inplace editing
This article describes how to edit files in-place programmatically. This has been part of my toolbox for a long time, so I thought I’d document it here.
This article describes how to edit files in-place programmatically. This has been part of my toolbox for a long time, so I thought I’d document it here.
As I’ve written about before (see engineering), I often use CalculiX for structural mechanics calculations of products made from composites. These often involve calculating lots of different combinations of materials, lay-ups and load cases. For convenience and for them being self-contained, each variant is usually in a different directory.
So when I find an improvement to e.g. a pre.fbd
, Makefile
or
job.inp
, I want modify all of the other instances as well.
This is where sed
(which stands for “stream editor”) comes into play.