Friday, April 2, 2010

How to delete last 10 lines in a file with script

I find this question asked very frequently... So here is the present of day(not for the April 1st, it's already 2nd in China now ;)

$ tac | sed '1,10d' | tac > file.out

Obviously, you could replace 10 with any number you like, Cheers!

No comments:

Post a Comment