Sed question
Bertram Scharpf
lists at bertram-scharpf.de
Sun Dec 21 14:20:11 UTC 2008
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 at thought.org> wrote:
> > >
> > > sed '8,10d'< file> newfile
> > > or is there a better way?
> >
> > keramida at 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
More information about the freebsd-questions
mailing list