On Thu, Mar 31, 2011, Jerry Geis wrote:
I can do "simply" search and replace with sed. However, I want to setup httpd.conf from a script that changes the default "/" which is presently:
While this can be done with sed, it's generally a lot easier to do with python or perl, particularly when dealing with multi-line replacement patterns.
It was this type of job that led me to perl in the late 1980s as perl was a lot easier to understand than advanced sed features, and there was only one regular expression syntax to remember. Currently I use python for most things, but don't want to start a scripting language wars thread here.
There's a very useful script 'replace' in the Kernighan and Pike book "The Unix Programming Environment" which uses sed for in-place replacements as an example of exception handling (MySQL has a similar 'replace' script but with different arguments which tells me that their developers hadn't done much basic *nix study as this book, while old, is still excellent).
The best book I've ever read on sed is "Unix Text Processing" by Dougherty and O'Reilly which covers many *nix utilities.
<Directory /> Options FollowSymLinks AllowOverride None </Directory>
and change it to the following:
<Directory /> Order Deny,Allow Deny from all AllowOverride None </Directory>
How do you do that with scripts? Basically substitute everything between the two Directory tags.
Thanks,
Jerry _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos