- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: sed to edit httpd.conf
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2006 04:19 AM
тАО02-15-2006 04:19 AM
For example when I find
Alias /manual/ "/usr/apache/htdocs/manual/"
Options Indexes FollowSymLinks MultiViews
AllowOverride None
I want to end up with
#Alias /manual/ "/usr/apache/htdocs/manual/"
#
# Options Indexes FollowSymLinks MultiViews
# AllowOverride None
#
I'm using sed, but having difficutly in finding the line starting Alias /manual/ and commenting out the next 4 lines too.
Comment out 1 line is
sed -e "/Alias \/manual\//s/^/# DONT'T ALLOW ACCESS TO THE MANUAL #/g" < httpd.conf.orig > httpd.conf
Any ideas would be appreciated.
Regards,
Dave.
Solved! Go to Solution.
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2006 04:41 AM
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2006 04:46 AM
тАО02-15-2006 04:46 AM
Re: sed to edit httpd.conf
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2006 04:49 AM
тАО02-15-2006 04:49 AM
Re: sed to edit httpd.conf
Perhaps something like:
# sed -ne '/Alias/,4 s/^/#/;p'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2006 04:49 AM
тАО02-15-2006 04:49 AM
Re: sed to edit httpd.conf
perl -p -e 's/^/#/ if /^Alias/../<\/Directory/' httpd.conf.orig >httpd.conf
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2006 04:54 AM
тАО02-15-2006 04:54 AM
Re: sed to edit httpd.conf
The BEGIN{$start=-99999} is because $start will assume to be zero upon first reference, so that the calculation would prefix "#" on the first few lines of the file.
HTH
-- Rod Hills