Oops, slight mistake:
At 12:39 PM 7/30/01 -0700, Peter Scott wrote:
>At 08:57 PM 7/30/01 +0300, alex stan wrote:
>>I need to search for a string in httpd.conf file , ( the string is :
>>CustomLog /var/log/httpd/site.com/access_log ) and then replace
>>inside them site.com with site_com. I mentioned that the site.com can take
>>diferent values, such as shop.com ,
>> radioq.com
>> etc.
>>Could you help me?
>>Thanks a lot
>
>Assuming that you want to replace dots with underscores in whatever
>appears between slashes in such a line:
Clarification: between the pair of slashes between 'httpd' and 'access_log'.
>open LOG, "httpd.conf" or die "Can't open httpd.conf: $!\n";
>while (<LOG>) {
> if (!^CustomLog /var/log/httpd/([^/]+)/access_log!) {
Should say if (m!^CustomLog ... (rest the same)
> my ($site = $1) =~ tr/./_/;
> s!httpd/[^/]+/!httpd/$site/!;
> }
> print;
>}
>close LOG;
Of course it can be done in one go but considering my recent comment about
being too clever...
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]