Linux / UNIX Tech Support Forum
This is a discussion on Comment out lines in .htaccess using sed command within the Shell scripting forums, part of the Development/Scripting category; 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 ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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. |
| Sponsored Links | ||
|
|
|
|||
|
Quote:
|
|
|||
|
It works.
Thank You. Code:
sed -i '/^php_*a*/ s/^/#/' myfile.txt Last edited by nixcraft; 04-07-2009 at 11:31 AM. |
![]() |
| Tags |
| .htaccess , apache , sed , update text file |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| BIND named.conf search zone and comment it out script | asim.mcp | Shell scripting | 2 | 15-06-2009 12:39 PM |
| Shell script to count number of lines in file specified by the second command-line | seaman77 | Shell scripting | 1 | 16-03-2009 07:46 PM |
| htaccess + invalid command | ephdia | Web servers | 0 | 19-09-2008 03:37 PM |
| Lighttpd Gallery2 URL Rewrite (.htaccess) SEO Rules | rootadmin | Web servers | 2 | 22-06-2008 06:57 PM |
| .htaccess problems | rcordeiro | Linux software | 4 | 05-07-2006 07:32 PM |