httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Agnello George" <>
Subject Re: [users@httpd] editing httpd.conf file through shell script
Date Fri, 20 Jun 2008 09:23:27 GMT
On 6/18/08, Mohit Anchlia <> wrote:
> You can use head and tail commands in shell to do what you want to do. You could do something
> x=`grep -n "DocumentRoot /websites/vodafone/web" httpd.conf` # gets the line number
> cat httpd.conf|head -$x > tmp.conf
> echo "AddType application/x-httpd-php .php" >> tmp.conf
> cat httpd.conf|tail +$x >> tmp.conf
> mv tmp.conf httpd.conf
> Above code is not tested. It's just for your understanding.

I was able to solve  my able query using sed command .. my script goes
some thing like that and its completely solve my problem

sed -i "/MIME_TYPE_$domain2631/a\AddType application x-httpd-php .php
\nAddType application x-httpd-php-source .phps"

the a ---> stand for append after the given pattern

the \n ---> stand for add ""this"" to next line

But one thing still remain is how do i remove or reverse this procedure ... ??


Agnello Dsouza
View raw message