From owner-freebsd-questions@FreeBSD.ORG Sun Dec 21 14:20:11 2008 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 5FAC11065670 for ; Sun, 21 Dec 2008 14:20:11 +0000 (UTC) (envelope-from lists@bertram-scharpf.de) Received: from mout-bounce.kundenserver.de (mout-bounce.kundenserver.de [212.227.17.2]) by mx1.freebsd.org (Postfix) with ESMTP id E6E4E8FC16 for ; Sun, 21 Dec 2008 14:20:10 +0000 (UTC) (envelope-from lists@bertram-scharpf.de) Received: from marge.bs.l (e180034204.adsl.alicedsl.de [85.180.34.204]) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis) id 0ML2xA-1LEOxP0F8v-0004Hu; Sun, 21 Dec 2008 15:06:59 +0100 Received: from bsch by marge.bs.l with local (Exim 4.69) (envelope-from ) id 1LEOxO-0006U6-En; Sun, 21 Dec 2008 15:06:58 +0100 Date: Sun, 21 Dec 2008 15:06:58 +0100 From: Bertram Scharpf To: Gary Kline , freebsd-questions@freebsd.org Message-ID: <20081221140658.GA24691@marge.bs.l> Mail-Followup-To: Gary Kline , freebsd-questions@freebsd.org References: <20081221053407.GA87868@thought.org> <877i5unkx4.fsf@kobe.laptop> <1229854084.6392.52.camel@ethos> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1229854084.6392.52.camel@ethos> User-Agent: Mutt/1.5.16 (2007-06-09) Sender: Bertram Scharpf X-Provags-ID: V01U2FsdGVkX1/TTo1NBzEyZz04111uauE+s3dNF8JPgYf5hqp iorqkU6+xEL5ySb8Nc8tg7q2xISI29LTT49rttW1zY8oJ0WGGP wGLNiN/22cCNuQcjfK30qGF3fIFcYC+25sowoO5mn8= Cc: Subject: Re: 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: Sun, 21 Dec 2008 14:20:11 -0000 Hi, Am Sonntag, 21. Dez 2008, 02:08:04 -0800 schrieb Gary Kline: > On Sun, 2008-12-21 at 07:42 +0200, Giorgos Keramidas wrote: > > On Sat, 20 Dec 2008 21:34:10 -0800, Gary Kline wrote: > > > > > > sed '8,10d'< file> newfile > > > or is there a better way? > > > > keramida@kobe:/tmp$ sed -i '' -e '2d' foo > > > thanks much. it works just fine in-place. ...but i did made a separate > copy, just in case;-) To make a copy, call $ sed -i .bak 8,10d myfile Be aware that the -i option is not portable. -> man sed /^STANDARDS Consider Perl or $ ruby -i.bak -pe 'next if 8..10 === $.' x Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de