Site icon Bytefreaks.net

Bash: head: Remove last N lines from file

Advertisements
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

Exit mobile version