Bash: head: Remove last N lines from file 3


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
Advertisements

This post is also available in: Greek


Leave a Reply

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

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