Sed – Delete a specific line in a file

sed -i ‘3d’ filename.ext

The above deletes the 3rd line in file filename.ext. The -i option replaces the filename.ext with the modified file (i.e. the change is made in place). Omit this option if that is not what you want.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *