1

with sed, how can I replace word within a matching line?

view story
linux-howto

http://unix.stackexchange.com – I am trying to write a sed expression to detect lines similer 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 ? (HowTos)