On Mon, Jun 10, 2002 at 09:42:56PM -0400, David Kramer wrote:
> 
> sed -e '/VirtualHost \*/,/\/VirtualHost/d' </www/conf/httpd.conf 
>>/www/conf/httpd.conf

Hi David,

Did you test this ?? I can tell you from bitter experience that you
need an intermediate file, using sed to read from some file
and write the result out to the same file simply does not work.

The reason being that the shell opens the file for writing first
thus truncating the file. It then does the sed edit on an empty
file resulting often in an empty file.

There is something about this in the Unix Tools book from OReilly,
I can remember reading it there but can't give you the page
reference. If someone has done it successfully using a version
of Unix and particular shell I would be interested to hear, but
on systems I've worked on it doesn't work.

If you need to edit the file in place without doing a shuffle to
another file then back use an ed script.

I hope I'm not hurting David's feelings by posting this but I
didn't want to see someone's files end up lacking in content whilst
I bite my tongue.

Paul.  



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to