sed is a non-destructive editor. This means the output of sed is displayed on screen but the original file is unchanged. If we want to modify the file, then we can redirect the output of the sed command to the file. Deleting lines is illustrated in the following examples:
$ sed '1,3d' datafile > tempfile $ mv tempfile newfile
In this example, we have deleted lines 1 to 3 and stored the output in tempfile. Then, we have to rename tempfile to newfile.