Artificial intelligent assistant

Appending word at the end of line with sed I have a code block as follows in a file: BalancerMember min=1 max=1000 loadfactor=1 timeout=30 keepalive=on route=tc_snode1 BalancerMember min=1 max=1000 loadfactor=1 timeout=30 keepalive=on route=tc_snode2 I want to search for all lines which had `tc_` keyword and add `status=D` at the end of those lines. So, the above entries will become like this BalancerMember min=1 max=1000 loadfactor=1 timeout=30 keepalive=on route=tc_snode1 status=D BalancerMember min=1 max=1000 loadfactor=1 timeout=30 keepalive=on route=tc_snode2 status=D I am using the following command to achieve this: sed -i '/tc_/a status=D' app.conf But I can see `status=D` is being after a newline. I don't want a newline for this. It should be appended with a '``' (space) .

try


sed -e '/tc_/s/$/ status=D/'


where

* `/tc_/` on line where tc_ is found,
* `s` substitute,
* `/$` end of line,
* `/ status=D/` by this string



if it looks OK, add `-i` to edit in place.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 8e7abef7400765bbcbae0ed405559b9e