On Sat, 20 Dec 2008 21:34:10 -0800, Gary Kline <[email protected]> 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:

  keram...@kobe:/tmp$ cat -n foo
       1  foo
       2  bar
       3  baz
  keram...@kobe:/tmp$ sed -i '' -e '2d' foo
  keram...@kobe:/tmp$ cat -n foo
       1  foo
       2  baz
  keram...@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.

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"

Reply via email to