[sed] Omit a particular line by number

Created on November 30, 2026

Use a line number followed by sed's d command to omit that line from the output. Save this example as dummy.txt.

one
two
three
four
five

The following command omits line 3.

sed '3d' dummy.txt
one
two
four
five

sed writes the result to standard output. To keep the filtered output in a file, redirect it to a different filename.

Bash Shell command sed