Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Dec 2008 15:06:58 +0100
From:      Bertram Scharpf <lists@bertram-scharpf.de>
To:        Gary Kline <kline@thought.org>, freebsd-questions@freebsd.org
Subject:   Re: Sed question
Message-ID:  <20081221140658.GA24691@marge.bs.l>
In-Reply-To: <1229854084.6392.52.camel@ethos>
References:  <20081221053407.GA87868@thought.org> <877i5unkx4.fsf@kobe.laptop> <1229854084.6392.52.camel@ethos>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <kline@thought.org> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081221140658.GA24691>