Date: Sun, 21 Dec 2008 02:08:04 -0800 From: Gary Kline <kline@thought.org> To: Giorgos Keramidas <keramida@ceid.upatras.gr> Cc: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: Sed question Message-ID: <1229854084.6392.52.camel@ethos> In-Reply-To: <877i5unkx4.fsf@kobe.laptop> References: <20081221053407.GA87868@thought.org> <877i5unkx4.fsf@kobe.laptop>
next in thread | previous in thread | raw e-mail | index | archive | help
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: > > 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;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1229854084.6392.52.camel>