How to use sed to remove the last n lines of a file

I don’t know about sed, but it can be done with head:

head -n -2 myfile.txt

Leave a Comment