Re: how to use sed to delete last lines of a file

From: Jan-Frode Myklebust (janfrode@PARALLAB.UIB.NO)
Date: Wed Oct 09 2002 - 14:25:19 EDT


On Wed, Oct 09, 2002 at 10:59:53AM -0700, Michelle DeVault wrote:
> That deletes the last line, but how about deleting
> more than that, say the last four lines of a file?

tac /etc/passwd | sed '1,4d' | tac

'tac' is the reverse of 'cat' and is found in GNU textutils on the
freeware collection.

  -jf



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:15 EDT