by @saigowthamr

How to replace a line in a text file by line number-Sed

Home » bash » How to replace a line in a text file by line number-Sed

To replace a line in a text file by using line number we can use the following command in sed.

sed '2 c\hello you can see me in 2nd line' myfile.txt

This above command will replace the second line with a hello you can see me in 2nd line.


Best Web Development courses