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
Quick and easy explanation. Been trying to find this solution for a while. I thought awk was the answer…..thanks heaps!
Thanks alot very straight forward, I got caught up in complexity of sed and this was exactly what I was looking for
Thank You……………………..It is very helpful…….:)
head -n -2 blacklist-nouveau.conf | sudo tee blacklist-nouveau.conf
For system file edit. >> or > will not work for system file