In this article let’s discuss about Linux remove last n lines from file. Let’s go through the following methods without any delay.
sed -i '$d' # to edit in place
If you are facing any issues with the above approach then try the alternative that is given below. It may look similar by have a try!
Method 2 :
#remove last 80 lines from cars.csv head -n -80 cars.csv > tmp.csv && mv tmp.csv cars.csv
Hope the above solution works.
Realted Posts : How to push code to gitlab