With permission of Ansgar Wiechers, I post a sed solution that seems to work for me:
sed -i.bak -e 's/^Line Length Limit=.*$/##&\nLine Length Limit=0/' ~/.kde4/share/config/katerc
It comments current value adding ##
at the beginning of the line and appending after that the same with 0
as value. I use the -i
switch that appends a .bak
suffix as backup to the original file. Use sed -i -e ...
(note the space between both switches) to modify the file in place. Be careful with this last option.
In my case, I prefer to modify files in-place with vim, so as extra I will post a one-liner that does the same than the previous sed command, only that its backup file is suffixed with ~
:
vim \
+'/^\v\cline\s+length\s+limit' \
-u NONE \
-N \
-c 'set backup | yank | s/\v^/##/ | put | s/\v(\=\s*)\d+/\10/ | x' \
~/.kde4/share/config/katerc