From owner-freebsd-questions@FreeBSD.ORG Tue Sep 25 01:37:24 2007 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3F4516A530 for ; Tue, 25 Sep 2007 01:37:24 +0000 (UTC) (envelope-from kline@tao.thought.org) Received: from tao.thought.org (dsl231-043-140.sea1.dsl.speakeasy.net [216.231.43.140]) by mx1.freebsd.org (Postfix) with ESMTP id 7BB7713C48A for ; Tue, 25 Sep 2007 01:37:23 +0000 (UTC) (envelope-from kline@tao.thought.org) Received: from tao.thought.org (localhost [127.0.0.1]) by tao.thought.org (8.13.8/8.13.1) with ESMTP id l8P1bNtF050080 for ; Mon, 24 Sep 2007 18:37:23 -0700 (PDT) (envelope-from kline@tao.thought.org) Received: (from kline@localhost) by tao.thought.org (8.13.8/8.13.1/Submit) id l8P1bNkM050079 for freebsd-questions@FreeBSD.ORG; Mon, 24 Sep 2007 18:37:23 -0700 (PDT) (envelope-from kline) Date: Mon, 24 Sep 2007 18:37:23 -0700 From: Gary Kline To: FreeBSD Mailing List Message-ID: <20070925013723.GA50027@thought.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: With 21 of service to the Unix community. Cc: Subject: sed question... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2007 01:37:24 -0000 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? thanks in advance, gary -- Gary Kline kline@thought.org www.thought.org Public Service Unix http://jottings.thought.org http://transfinite.thought.org