The delete command

You can use the delete command d to delete lines or a range of lines from your stream. The following command will delete the third line from the stream: 

$ sed '3d' myfile  

The following command will delete the third to the fifth line from the stream:

$ sed '3,5d' myfile  

 This command will delete from the fourth line to the end of the file:

$ sed '4,$d' myfile

Note that the deletion happens only to the stream, not the actual file. So if you want to delete from the actual file, you can use the -i option:

$ sed -i '2d' myfile #Permenantly delete the second line from the file