Re: sed question...

[ Available lists | Index of freebsd-questions | Month of Sep 2007 | Week of 25 Sep 2007 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Howard Goldstein <hg@queue.to>
Date
25 Sep 2007 03:07:22
Subject
Re: sed question...
Message-ID
46F87B68.6090607@queue.to

In reply to
References to

[ Hide this part ]
Gary Kline wrote:
> My earlier post about deleting the first N lines was answered by
> this one-liner site {below}. I wasn't including any
> redirection; doing so finally resolved the problem. Now I need
> to delete every line from the 19th or so to the last line.
> Question one, can anybody explain the following syntax? What do
> "P", "D" "ba" represent, in other words?
>
>
> # delete the last 10 lines of a file
> sed -e :a -e '$d;N;2,10ba' -e 'P;D' # method 1
> sed -n -e :a -e '1,10!{P;N;D;};N;ba' # method 2
>
>
> Question two, can sed do its thing inline?

Wouldn't it be easier to use head -n 18 ?



Elapsed time: 0.149 seconds