Author Login
Post Reply
On 6/18/08, Mohit Anchlia <mohitanchlia@(protected):
>
> You can use head and tail commands in shell to do what you want to do. You could do something like:
>
> 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"
/usr/local/apache2/conf/extra/httpd_vhost.conf
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
www.linux-vashi.blogspot.com