Table of Contents
patchconf — Smart patching of config files
patchconf
--file <filename> --name <name> --value <value> [options]
Patchconf is very simple utility for patching configurationfiles. All configuration files contains strings as "name=value". For changing this value Youmust open the file and edit it byhand. But patchconf does it for You.
Change value(s) of defined variable. Patchconf can adds new value at the end ( at the start) of old values or replace old value(s) for new.
In file test.conf:
... some_value=some_value ...
Command: patchconf -f test.conf -n some_name -v new_value -m replace
In file test.conf:
... some_value=new_value ...
Modify of comments: patchconf can adds/erase/keep one-line comment before string which contains defined variable.
In file test.conf:
... # some comment some_value=some_value ...
Command: patchconf -f test.conf -n some_name -v new_value --com-mode replace
In file test.conf:
... # patchconf: next line modified by patchconf some_value=some_value ...
The main target of patchconf is a simple patching of values of some variable called 'name'. Patchconf can do it. 'Value' defined by user may be adding to the end of already exist values, insert at begin of already exist values or insert instead of already exist values. New position of 'value' defined by follow option:
this key may contain three value:
add 'value' adding at the end(this option set as default)
ins insert 'value' at the begin
replace replace old values
But what happened if 'name' not found? In this case patchconf can add new string: "name=value" at the begin or at the end of file. This possibility defined by follow option:
Before all patching lines patchconf insert own comment as: "# pathconf: next line was patching by patchconf". Patchconf correctly parse line comments before line and can patching it also. Also allowed user-defined line-comments.