A useful option of sed command to replace multiple lines with a single line upon matching a given string. $ cat -n file.txt Hello world Hello nobody nobody Somebody anybody If you want to replace the lines 2 and 3 with another line "Hello everybody" the below command will help. $ sed '/nobody$/{N;s/Hello nobody\nnobody/Hello everybody/}' file.txt $ cat -n file.txt 1 hello world 2 Hello everybody 3 Somebody 4 anybody
This is an attempt by me to explore articles and News related with Technology(especially IT),Film,Art,etc Actually this is my personal documentation area where I keep projects' documents and the Tutorials I have read through in the Internet. Have a look and let me know your opinion