Text replacement for multiple script/config files

Posted by user343804 on Stack Overflow See other posts from Stack Overflow or by user343804
Published on 2010-05-18T09:13:12Z Indexed on 2010/05/22 9:40 UTC
Read the original article Hit count: 155

Filed under:
|
|
|

I am doing some sort of science with a combination of Python, bash scripts and configuration files with weird syntaxes from old C programs. To run different tests, I have to tune (open text file, edit and save) a number of these files, but it is getting harder and harder to remember which files to edit. Also, the tasks are very repetitive and I end having a bunch of comment lines, switching on and off the settings for a specific run.

I dream of a tool that can keep a list of files (regardless of the file format) and allow me to centrally choose from a predefined list of "profiles", taking care of editing the script/config files. For example lets say I have a config and script file:

config.cfg

var1 = 1.0
#var1 = 1.5

script.sct

function(200.0)
#function(300.0)

I would like to instead have auxiliary text files:

config.cfg.tem

var1 = $$var1$$

script.sct.tem

function($$par1$$)

and in a central script or even better, a GUI, just switch from profile1 (e.g. var1=1.0,par1=200.0) to profile2 (e.g. var1=1.5,par1=300.0), and the tool to automatically update the text files.

Any idea if such a tools exists?

© Stack Overflow or respective owner

Related posts about scripting

Related posts about template