Remove lines from end of file

For some reason, when looking online, all solutions for removing lines from the end of a file were not working using sed. I found this and it worked

https://stackoverflow.com/questions/4881930/remove-the-last-line-from-a-file-in-bash

sed -i '' -e '$ d' foo.txt

Leave a Reply

Your email address will not be published.