mod_sed.html.en revision 5effc8b39fae5cd169d17f342bfc265705840014
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
7db058a7846888b8823fca9e8135f395265ef1d8nilgun XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7db058a7846888b8823fca9e8135f395265ef1d8nilgun This file is generated from xml source: DO NOT EDIT
7db058a7846888b8823fca9e8135f395265ef1d8nilgun XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<link href="/images/favicon.ico" rel="shortcut icon" /></head>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.5</a> > <a href="./">Modules</a></div>
d3bd91523e4565551991605fb157fea59c3610e2gryzor<p><span>Available Languages: </span><a href="/en/mod/mod_sed.html" title="English"> en </a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/fr/mod/mod_sed.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a></p>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Filter Input (request) and Output (response) content using <code>sed</code> syntax</td></tr>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Experimental</td></tr>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>sed_module</td></tr>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_sed.c sed0.c sed1.c regexp.c regexp.h sed.h</td></tr>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3 and later</td></tr></table>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton<code class="module"><a href="/mod/mod_sed.html">mod_sed</a></code> is an in-process content filter. The <code class="module"><a href="/mod/mod_sed.html">mod_sed</a></code> filter implements the <code>sed</code> editing
50cb7e2b30597f481fee57bac945190f06ebcc58jortoncommands implemented by the Solaris 10 <code>sed</code>
50cb7e2b30597f481fee57bac945190f06ebcc58jortonprogram as described in the <a href="http://docs.sun.com/app/docs/doc/816-5165/sed-1b?a=view">manual
50cb7e2b30597f481fee57bac945190f06ebcc58jortonpage</a>. However, unlike <code>sed</code>, <code class="module"><a href="/mod/mod_sed.html">mod_sed</a></code> doesn't take data from
c9f4eb2763c1d6ba9a3d26828e1729e476d0bb1epctonyinput. Instead, the filter acts on the entity data sent between client and
50cb7e2b30597f481fee57bac945190f06ebcc58jortonserver. <code class="module"><a href="/mod/mod_sed.html">mod_sed</a></code> can be used as an input or output filter. <code class="module"><a href="/mod/mod_sed.html">mod_sed</a></code> is a
c9f4eb2763c1d6ba9a3d26828e1729e476d0bb1epctonycontent filter, which means that it cannot be used to modify client or
7db058a7846888b8823fca9e8135f395265ef1d8nilgunserver http headers.
50cb7e2b30597f481fee57bac945190f06ebcc58jortonThe <code class="module"><a href="/mod/mod_sed.html">mod_sed</a></code> output filter accepts a chunk of data, executes the <code>sed</code> scripts on the data, and generates the output which is passed to the next filter in the chain.
50cb7e2b30597f481fee57bac945190f06ebcc58jortonThe <code class="module"><a href="/mod/mod_sed.html">mod_sed</a></code> input filter reads the data from the next filter in the chain, executes the <code>sed</code> scripts, and returns the generated data to the caller filter in the filter chain.
50cb7e2b30597f481fee57bac945190f06ebcc58jortonBoth the input and output filters only process the data if newline characters are seen in the content. At the end of the data, the rest of the data is treated as the last line.
50cb7e2b30597f481fee57bac945190f06ebcc58jorton<p>A tutorial article on <code class="module"><a href="/mod/mod_sed.html">mod_sed</a></code>, and why it is more powerful than simple
c9f4eb2763c1d6ba9a3d26828e1729e476d0bb1epctonystring or regular expression search and replace, is available <a href="http://blogs.sun.com/basant/entry/using_mod_sed_to_filter">on
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div id="quickview"><h3 class="directives">Directives</h3>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<li><img alt="" src="/images/down.gif" /> <a href="#inputsed">InputSed</a></li>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<li><img alt="" src="/images/down.gif" /> <a href="#outputsed">OutputSed</a></li>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<li><img alt="" src="/images/down.gif" /> <a href="#sampleconf">Sample Configuration</a></li>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<li><img alt="" src="/images/down.gif" /> <a href="#sed_commands">Sed Commands</a></li>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<h2><a name="sampleconf" id="sampleconf">Sample Configuration</a></h2>
c9f4eb2763c1d6ba9a3d26828e1729e476d0bb1epctony <div class="example"><h3>Adding an output filter </h3><p><code>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton # In the following example, the sed filter will change the string<br />
50cb7e2b30597f481fee57bac945190f06ebcc58jorton # "monday" to "MON" and the string "sunday" to SUN in html documents<br />
50cb7e2b30597f481fee57bac945190f06ebcc58jorton # before sending to the client.<br />
7db058a7846888b8823fca9e8135f395265ef1d8nilgun AddOutputFilter Sed html <br />
7db058a7846888b8823fca9e8135f395265ef1d8nilgun </Directory> <br />
c9f4eb2763c1d6ba9a3d26828e1729e476d0bb1epctony <div class="example"><h3>Adding an input filter </h3><p><code>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton # In the following example, the sed filter will change the string<br />
50cb7e2b30597f481fee57bac945190f06ebcc58jorton # "monday" to "MON" and the string "sunday" to SUN in the POST data<br />
50cb7e2b30597f481fee57bac945190f06ebcc58jorton # sent to PHP.<br />
7db058a7846888b8823fca9e8135f395265ef1d8nilgun AddInputFilter Sed php <br />
7db058a7846888b8823fca9e8135f395265ef1d8nilgun </Directory> <br />
7db058a7846888b8823fca9e8135f395265ef1d8nilgun</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<h2><a name="sed_commands" id="sed_commands">Sed Commands</a></h2>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton Complete details of the <code>sed</code> command can be found from the
50cb7e2b30597f481fee57bac945190f06ebcc58jorton <a href="http://docs.sun.com/app/docs/doc/816-5165/sed-1b?a=view">sed manual
50cb7e2b30597f481fee57bac945190f06ebcc58jorton <dd>Branch to the label specified (similar to goto).</dd>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton <dd>Swap the contents of the hold buffer and the current line.</dd>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div class="directive-section"><h2><a name="InputSed" id="InputSed">InputSed</a> <a name="inputsed" id="inputsed">Directive</a></h2>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sed command to filter request data (typically <code>POST</code> data)</td></tr>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>InputSed <var>sed-command</var></code></td></tr>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Experimental</td></tr>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_sed</td></tr>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton <p>The <code class="directive">InputSed</code> directive specifies the <code>sed</code> command
50cb7e2b30597f481fee57bac945190f06ebcc58jorton to execute on the request data e.g., <code>POST</code> data.
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div class="directive-section"><h2><a name="OutputSed" id="OutputSed">OutputSed</a> <a name="outputsed" id="outputsed">Directive</a></h2>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sed command for filtering response content</td></tr>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>OutputSed <var>sed-command</var></code></td></tr>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Experimental</td></tr>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_sed</td></tr>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton <p>The <code class="directive">OutputSed</code> directive specifies the <code>sed</code>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton command to execute on the response.
d3bd91523e4565551991605fb157fea59c3610e2gryzor<p><span>Available Languages: </span><a href="/en/mod/mod_sed.html" title="English"> en </a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/fr/mod/mod_sed.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a></p>
5effc8b39fae5cd169d17f342bfc265705840014rbowen<p class="apache">Copyright 2012 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>