Re: script question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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@xxxxxxxxxx
>http://lists.centos.org/mailman/listinfo/centos
>

-- 
Bill
-- 
INTERNET:   bill@xxxxxxxxxxxxx  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186  Skype: jwccsllc (206) 855-5792

It's just got so that 90 percent of the people in this country don't give
a damn.  Politics ain't worrying this country one tenth as much as parking
space. -- Will Rogers
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux