<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: sed to edit httpd.conf in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732276#M101035</link>
    <description>If your text will be bracketed by "Alias" and "", then here is a simpler perl method-&lt;BR /&gt; &lt;BR /&gt;perl -p -e 's/^/#/ if /^Alias/../&amp;lt;\/Directory/' httpd.conf.orig &amp;gt;httpd.conf&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills&lt;BR /&gt; &lt;BR /&gt;</description>
    <pubDate>Wed, 15 Feb 2006 12:49:59 GMT</pubDate>
    <dc:creator>Rodney Hills</dc:creator>
    <dc:date>2006-02-15T12:49:59Z</dc:date>
    <item>
      <title>sed to edit httpd.conf</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732272#M101031</link>
      <description>I want to edit httpd.conf. Specifically I want to comment out a section of the config file.&lt;BR /&gt;&lt;BR /&gt;For example when I find &lt;BR /&gt;&lt;BR /&gt;Alias /manual/ "/usr/apache/htdocs/manual/"&lt;BR /&gt;&lt;DIRECTORY&gt;&lt;BR /&gt;    Options Indexes FollowSymLinks MultiViews&lt;BR /&gt;    AllowOverride None&lt;BR /&gt;&lt;/DIRECTORY&gt;&lt;BR /&gt;&lt;BR /&gt;I want to end up with&lt;BR /&gt;&lt;BR /&gt;#Alias /manual/ "/usr/apache/htdocs/manual/"&lt;BR /&gt;#&lt;DIRECTORY&gt;&lt;BR /&gt;#    Options Indexes FollowSymLinks MultiViews&lt;BR /&gt;#    AllowOverride None&lt;BR /&gt;#&lt;/DIRECTORY&gt;&lt;BR /&gt;&lt;BR /&gt;I'm using sed, but having difficutly in finding the line starting Alias /manual/ and commenting out the next 4 lines too. &lt;BR /&gt;&lt;BR /&gt;Comment out 1 line is&lt;BR /&gt;&lt;BR /&gt;sed -e "/Alias \/manual\//s/^/# DONT'T ALLOW ACCESS TO THE MANUAL #/g" &amp;lt; httpd.conf.orig &amp;gt; httpd.conf&lt;BR /&gt;&lt;BR /&gt;Any ideas would be appreciated.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Dave.&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Feb 2006 12:19:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732272#M101031</guid>
      <dc:creator>David Burgess</dc:creator>
      <dc:date>2006-02-15T12:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: sed to edit httpd.conf</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732273#M101032</link>
      <description>Perl can do that fairly easily&lt;BR /&gt; &lt;BR /&gt;perl -p -e 'BEGIN{$start=-99999};$start=$. if /^Alias/; s/^/#/ if $.-$start &amp;lt;5' httpd.conf.orig &amp;gt;httpd.conf&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Wed, 15 Feb 2006 12:41:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732273#M101032</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2006-02-15T12:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: sed to edit httpd.conf</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732274#M101033</link>
      <description>Works a treat and worth 10 points. Can you briefly explain how it works? I can see it's a loop. Wy start at 99999?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Feb 2006 12:46:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732274#M101033</guid>
      <dc:creator>David Burgess</dc:creator>
      <dc:date>2006-02-15T12:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: sed to edit httpd.conf</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732275#M101034</link>
      <description>Hi Dave:&lt;BR /&gt;&lt;BR /&gt;Perhaps something like:&lt;BR /&gt;&lt;BR /&gt;# sed -ne '/Alias/,4 s/^/#/;p' &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 15 Feb 2006 12:49:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732275#M101034</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-02-15T12:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: sed to edit httpd.conf</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732276#M101035</link>
      <description>If your text will be bracketed by "Alias" and "", then here is a simpler perl method-&lt;BR /&gt; &lt;BR /&gt;perl -p -e 's/^/#/ if /^Alias/../&amp;lt;\/Directory/' httpd.conf.orig &amp;gt;httpd.conf&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Wed, 15 Feb 2006 12:49:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732276#M101035</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2006-02-15T12:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: sed to edit httpd.conf</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732277#M101036</link>
      <description>My first method works by setting variable $start to the current line number when "Alias" is found, then the "#" is prefixed on any line where the current line number - $start &amp;lt; the number of lines to modify.&lt;BR /&gt; &lt;BR /&gt;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.&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Wed, 15 Feb 2006 12:54:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed-to-edit-httpd-conf/m-p/3732277#M101036</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2006-02-15T12:54:47Z</dc:date>
    </item>
  </channel>
</rss>

