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:

open LOG, "httpd.conf" or die "Can't open httpd.conf: $!\n";
while (<LOG>) {
     if (!^CustomLog /var/log/httpd/([^/]+)/access_log!) {
         my ($site = $1) =~ tr/./_/;
         s!httpd/[^/]+/!httpd/$site/!;
     }
     print;
}
close LOG;

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to