From owner-freebsd-questions@FreeBSD.ORG Sun Dec 21 10:06:24 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 7D8AB106564A for ; Sun, 21 Dec 2008 10:06:24 +0000 (UTC) (envelope-from kline@thought.org) Received: from aristotle.thought.org (aristotle.thought.org [209.180.213.210]) by mx1.freebsd.org (Postfix) with ESMTP id 407728FC12 for ; Sun, 21 Dec 2008 10:06:23 +0000 (UTC) (envelope-from kline@thought.org) Received: from [10.47.0.180] (ethos.thought.org [10.47.0.180]) (authenticated bits=0) by aristotle.thought.org (8.14.2/8.14.2) with ESMTP id mBLA6kNw013742; Sun, 21 Dec 2008 02:06:47 -0800 (PST) (envelope-from kline@thought.org) From: Gary Kline To: Giorgos Keramidas In-Reply-To: <877i5unkx4.fsf@kobe.laptop> References: <20081221053407.GA87868@thought.org> <877i5unkx4.fsf@kobe.laptop> Content-Type: text/plain Organization: Thought Unlimited Date: Sun, 21 Dec 2008 02:08:04 -0800 Message-Id: <1229854084.6392.52.camel@ethos> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=3.6 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on aristotle.thought.org Cc: FreeBSD Mailing List 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 10:06:24 -0000 On Sun, 2008-12-21 at 07:42 +0200, Giorgos Keramidas wrote: > On Sat, 20 Dec 2008 21:34:10 -0800, Gary Kline wrote: > > how can i delete, say, lines 8,9,and 10 from 200 files > > using sed? Is it > > > > sed '8,10d'< file> newfile > > or is there a better way? > > Use in-place editing: > > keramida@kobe:/tmp$ cat -n foo > 1 foo > 2 bar > 3 baz > keramida@kobe:/tmp$ sed -i '' -e '2d' foo > keramida@kobe:/tmp$ cat -n foo > 1 foo > 2 baz > keramida@kobe:/tmp$ > > Look at the manpage of sed for more details about the -i option, and > consider using backup files while you are running tests. In-place > editing is very cool, but it can also make changes that are difficult > to recover from. > thanks much. it works just fine in-place. ...but i did made a separate copy, just in case;-)