Bash: head: Remove last N lines from file 4


head -n -$N inputFile > outputFile

Where $N is the number of the line from the end which you want to stop printing.
For example if you want to delete the last line you must issue the following:

head -n -1 inputFile > outputFile

This post is also available in: Greek


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

4 thoughts on “Bash: head: Remove last N lines from file