I need to replace pattern matching line with yet another string.
Example
line1
line2
the serial port is ttyS0
line4
I need to replace line containing ttyS0 as
line1
line2
You have to use usb interface
line4
How can I do that in sed (or grep)
I tried sed 's/ttyS0/You have to use usb interface/' myfile . But it replaces only the matching words from the line. I want to replace the complete line.
Like this: