


The sed command can be used to delete a range of lines. The below sed command removes the second line in a file. The following sed command is used to remove the footer line in a file. Delete last line or footer line or trailer line In the following example, the sed command removes the first line in a file.Ģ. The d option in sed command is used to delete a line. In the following examples, the sed command removes the lines in file that are in a particular position in a file. Sed Command to Delete Lines - Based on Position in File The following file contains a sample data which is used as input file in all the examples: Here we will see how to delete lines using sed command with various examples. Sed Command to Delete Lines: Sed command can be used to delete or remove specific lines which matches a given pattern or in a particular position in a file.
