View Single Post
  #2 (permalink)  
Old 07-04-2009, 12:42 AM
cfajohnson cfajohnson is offline
Member
User
 
Join Date: May 2009
OS: Mandriva
Posts: 78
Thanks: 0
Thanked 14 Times in 14 Posts
Rep Power: 2
cfajohnson has a spectacular aura about cfajohnson has a spectacular aura about
Default

Quote:
Originally Posted by cosminnci View Post
Hello,

I need a script that changes in .htaccess all occurrences of:
php_flag magic_quotes_gpc on
php_value max_execution_time 60
php_flag magic_quotes_runtime off
php_flag asp_tags off
php_flag register_globals on

and other variations of php_*a*
need to insert # in front.

would try with sed
sed -e 's/^php_*a*/#php../g' myfile.txt

what is the correct syntax for this?
could also encounter other "php" occurences in the file.

It will only match php at the beginning of a line because you anchored the regex with ^.

You could also use:

Code:
sed '/^php_*a*/ s/^/#/' myfile.txt
Reply With Quote