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

From: Michelle DeVault (adsmigmo@YAHOO.COM)
Date: Wed Oct 09 2002 - 15:46:19 EDT


This works lovely. Can you explain the syntax though?
 As is apparently evident, I am not a sed expert.

--- "Naylor, Jim" <Jnaylor@SCHNUCKS.COM> wrote:
> Try this:
>
> sed -e :a -e '$d;N;2,4ba' -e 'P;D' inputfile >
> outputfile
>
> -----Original Message-----
> From: Michelle DeVault [mailto:adsmigmo@YAHOO.COM]
> Sent: Wednesday, October 09, 2002 1:00 PM
> To: aix-l@Princeton.EDU
> Subject: Re: how to use sed to delete last lines of
> a file
>
>
> That deletes the last line, but how about deleting
> more than that, say the last four lines of a file?
>
>
> --- "Naylor, Jim" <Jnaylor@SCHNUCKS.COM> wrote:
> > sed '$d' inputfile > outputfile
> >
> > -----Original Message-----
> > From: Michelle DeVault [mailto:adsmigmo@YAHOO.COM]
> > Sent: Wednesday, October 09, 2002 10:18 AM
> > To: aix-l@Princeton.EDU
> > Subject: how to use sed to delete last lines of a
> > file
> >
> >
> > Is there a simple syntax for sed to delete the
> last
> > lines of a file without having to count the number
> > of
> > lines in the file?
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Faith Hill - Exclusive Performances, Videos & More
> > http://faith.yahoo.com
>
>
> __________________________________________________
> Do you Yahoo!?
> Faith Hill - Exclusive Performances, Videos & More
> http://faith.yahoo.com

__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com



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