I am trying to write a sed expression to detect lines similar to this:
s0:12345:respawn:/sbin/agetty -8 -s 115200 ttyS0 linux
and replace the ttys0
with something_else
I do not want to detect commented out lines (beginning with #
)
I can replace the whole line, but how to I just replace the substring, leaving the rest of the line intact ?
Best Answer
One way to do this is as follows: