How do you remove the last line of a file?
Answer
You can remove the newline character at the end of file using following easy way:
Answer
You can remove the newline character at the end of file using following easy way:
- head -c -1 file. From man head : -c, –bytes=[-]K print the first K bytes of each file; with the leading ‘-‘, print all but the last K bytes of each file.
- truncate -s -1 file.