@Gedimin,
here's a snippet from GNU man sed
:
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if SUFFIX supplied)
I think you're misinterpreting the spec of the -i
and it's meaning - see if the above man
helps.
Also it might help if you provided a representative sample of one of your cfg
files.
Please you markdown code tags when posting code/data samples - markdown specs are described here - I've edited your post for now, but do properly format your posts going forward.