7db058a7846888b8823fca9e8135f395265ef1d8nilgun<?xml version="1.0" encoding="ISO-8859-1"?>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<!--
7db058a7846888b8823fca9e8135f395265ef1d8nilgun XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7db058a7846888b8823fca9e8135f395265ef1d8nilgun This file is generated from xml source: DO NOT EDIT
7db058a7846888b8823fca9e8135f395265ef1d8nilgun XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7db058a7846888b8823fca9e8135f395265ef1d8nilgun -->
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc<title>mod_sed - Apache HTTP Server Version 2.5</title>
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" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
2e545ce2450a9953665f701bb05350f0d3f26275nd<script src="/style/scripts/prettify.min.js" type="text/javascript">
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen</script>
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<link href="/images/favicon.ico" rel="shortcut icon" /></head>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<body>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div id="page-header">
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<p class="apache">Apache HTTP Server Version 2.5</p>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<img alt="" src="/images/feather.gif" /></div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div id="path">
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Modules</a></div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div id="page-content">
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div id="preamble"><h1>Apache Module mod_sed</h1>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div class="toplang">
d3bd91523e4565551991605fb157fea59c3610e2gryzor<p><span>Available Languages: </span><a href="/en/mod/mod_sed.html" title="English">&nbsp;en&nbsp;</a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/fr/mod/mod_sed.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a></p>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun</div>
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>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<h3>Summary</h3>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<p>
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>
e10f97d0097170c9843f6cf335dfeef0b44cd83crbowenprogram as described in the <a href="http://www.gnu.org/software/sed/manual/sed.txt">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
7db058a7846888b8823fca9e8135f395265ef1d8nilgunstandard
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.
7db058a7846888b8823fca9e8135f395265ef1d8nilgun</p>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<p>
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.
7db058a7846888b8823fca9e8135f395265ef1d8nilgun</p>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<p>
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.
7db058a7846888b8823fca9e8135f395265ef1d8nilgun</p>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<p>
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.
7db058a7846888b8823fca9e8135f395265ef1d8nilgun</p>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun
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
e10f97d0097170c9843f6cf335dfeef0b44cd83crbowenstring or regular expression search and replace, is available <a href="https://blogs.oracle.com/basant/entry/using_mod_sed_to_filter">on
7db058a7846888b8823fca9e8135f395265ef1d8nilgunthe author's blog</a>.</p>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun
7db058a7846888b8823fca9e8135f395265ef1d8nilgun</div>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri<div id="quickview"><h3>Topics</h3>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri<ul id="topics">
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri<li><img alt="" src="/images/down.gif" /> <a href="#sampleconf">Sample Configuration</a></li>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri<li><img alt="" src="/images/down.gif" /> <a href="#sed_commands">Sed Commands</a></li>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri</ul><h3 class="directives">Directives</h3>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<ul id="toc">
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</ul>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri<ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div class="section">
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<h2><a name="sampleconf" id="sampleconf">Sample Configuration</a></h2>
4aa603e6448b99f9371397d439795c91a93637eand <div class="example"><h3>Adding an output filter </h3><pre class="prettyprint lang-config"># In the following example, the sed filter will change the string
17ade6df5ec233536985eb1c130a906c725dd614humbedooh# "monday" to "MON" and the string "sunday" to SUN in html documents
17ade6df5ec233536985eb1c130a906c725dd614humbedooh# before sending to the client.
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar&lt;Directory "/var/www/docs/sed"&gt;
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar AddOutputFilter Sed html
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar OutputSed "s/monday/MON/g"
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar OutputSed "s/sunday/SUN/g"
4aa603e6448b99f9371397d439795c91a93637eand&lt;/Directory&gt;</pre>
e487d6c09669296f94a5190cc34586a98e624a00nd</div>
17ade6df5ec233536985eb1c130a906c725dd614humbedooh
4aa603e6448b99f9371397d439795c91a93637eand <div class="example"><h3>Adding an input filter </h3><pre class="prettyprint lang-config"># In the following example, the sed filter will change the string
17ade6df5ec233536985eb1c130a906c725dd614humbedooh# "monday" to "MON" and the string "sunday" to SUN in the POST data
17ade6df5ec233536985eb1c130a906c725dd614humbedooh# sent to PHP.
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar&lt;Directory "/var/www/docs/sed"&gt;
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar AddInputFilter Sed php
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar InputSed "s/monday/MON/g"
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar InputSed "s/sunday/SUN/g"
4aa603e6448b99f9371397d439795c91a93637eand&lt;/Directory&gt;</pre>
e487d6c09669296f94a5190cc34586a98e624a00nd</div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div class="section">
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<h2><a name="sed_commands" id="sed_commands">Sed Commands</a></h2>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun <p>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton Complete details of the <code>sed</code> command can be found from the
7153ff43420a22c7f6213937b6b210f25d02c464rbowen <a href="http://www.gnu.org/software/sed/manual/sed.txt">sed manual
7db058a7846888b8823fca9e8135f395265ef1d8nilgunpage</a>.
7db058a7846888b8823fca9e8135f395265ef1d8nilgun </p>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun <dl>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun <dt><code>b</code></dt>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton <dd>Branch to the label specified (similar to goto).</dd>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun <dt><code>h</code></dt>
c9f4eb2763c1d6ba9a3d26828e1729e476d0bb1epctony <dd>Copy the current line to the hold buffer.</dd>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun <dt><code>H</code></dt>
c9f4eb2763c1d6ba9a3d26828e1729e476d0bb1epctony <dd>Append the current line to the hold buffer.</dd>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun <dt><code>g</code></dt>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton <dd>Copy the hold buffer to the current line.</dd>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun <dt><code>G</code></dt>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton <dd>Append the hold buffer to the current line.</dd>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun <dt><code>x</code></dt>
50cb7e2b30597f481fee57bac945190f06ebcc58jorton <dd>Swap the contents of the hold buffer and the current line.</dd>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun </dl>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun</div>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<div class="directive-section"><h2><a name="InputSed" id="InputSed">InputSed</a> <a name="inputsed" id="inputsed">Directive</a></h2>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<table class="directive">
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<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>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>InputSed <var>sed-command</var></code></td></tr>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Experimental</td></tr>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_sed</td></tr>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar</table>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <p>The <code class="directive">InputSed</code> directive specifies the <code>sed</code> command
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar to execute on the request data e.g., <code>POST</code> data.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar </p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar</div>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<div class="directive-section"><h2><a name="OutputSed" id="OutputSed">OutputSed</a> <a name="outputsed" id="outputsed">Directive</a></h2>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<table class="directive">
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sed command for filtering response content</td></tr>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>OutputSed <var>sed-command</var></code></td></tr>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Experimental</td></tr>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_sed</td></tr>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar</table>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <p>The <code class="directive">OutputSed</code> directive specifies the <code>sed</code>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar command to execute on the response.
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar </p>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar</div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun</div>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun<div class="bottomlang">
d3bd91523e4565551991605fb157fea59c3610e2gryzor<p><span>Available Languages: </span><a href="/en/mod/mod_sed.html" title="English">&nbsp;en&nbsp;</a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/fr/mod/mod_sed.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a></p>
727872d18412fc021f03969b8641810d8896820bhumbedooh</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
0d0ba3a410038e179b695446bb149cce6264e0abnd<script type="text/javascript"><!--//--><![CDATA[//><!--
727872d18412fc021f03969b8641810d8896820bhumbedoohvar comments_shortname = 'httpd';
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohvar comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_sed.html';
0d0ba3a410038e179b695446bb149cce6264e0abnd(function(w, d) {
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread"><\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd var s = d.createElement('script');
0d0ba3a410038e179b695446bb149cce6264e0abnd s.type = 'text/javascript';
0d0ba3a410038e179b695446bb149cce6264e0abnd s.async = true;
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
0d0ba3a410038e179b695446bb149cce6264e0abnd (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
0d0ba3a410038e179b695446bb149cce6264e0abnd }
0d0ba3a410038e179b695446bb149cce6264e0abnd else {
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd }
0d0ba3a410038e179b695446bb149cce6264e0abnd})(window, document);
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh//--><!]]></script></div><div id="footer">
205f749042ed530040a4f0080dbcb47ceae8a374rjung<p class="apache">Copyright 2015 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>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
0d0ba3a410038e179b695446bb149cce6264e0abndif (typeof(prettyPrint) !== 'undefined') {
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd prettyPrint();
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd}
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd//--><!]]></script>
7db058a7846888b8823fca9e8135f395265ef1d8nilgun</body></html>