Lại Phương Thanh
New member
How do I remove the last two lines in Unix?
Answer
It’s a little roundabout, but I think it’s easy to follow.
Answer
It’s a little roundabout, but I think it’s easy to follow.
- Count up the number of lines in the main file.
- Subtract the number of lines you want to remove from the count.
- Print out the number of lines you want to keep and store in a temp file.
- Replace the main file with the temp file.
- Remove the temp file.