https://mailutils.org/usqay/index.php?title=Mailutils_filter&feed=atom&action=historyMailutils filter - Revision history2024-03-29T00:20:55ZRevision history for this page on the wikiMediaWiki 1.35.13https://mailutils.org/usqay/index.php?title=Mailutils_filter&diff=401&oldid=prevGray: Created page with "The <tt>mailutils filter</tt> command applies a chain of filters to the input. The filters to apply and their arguments are given in the command line. The full invo..."2015-07-11T10:58:53Z<p>Created page with "The <tt><a href="/wiki/Mu" class="mw-redirect" title="Mu">mailutils</a> filter</tt> command applies a chain of <a href="/usqay/index.php?title=Filter&action=edit&redlink=1" class="new" title="Filter (page does not exist)">filters</a> to the input. The filters to apply and their arguments are given in the command line. The full invo..."</p>
<p><b>New page</b></p><div>The <tt>[[mu|mailutils]] filter</tt> command applies a chain of [[filter]]s to the input. The filters to apply and their arguments are given <br />
in the command line. The full invocation syntax is:<br />
<br />
mailutils filter [''option''] ''filter-chain''<br />
<br />
The syntax for ''filter-chain'' in Backus-Naur form follows:<br />
<br />
<source lang="bnf"><br />
<filter-chain> ::= <filter> | <filter-chain> "+" <filter><br />
<filter> ::= <filter-spec> <ARG>* <br />
<filter-spec> ::= <WORD> | "~" <WORD><br />
</source><br />
<br />
where <tt><WORD></tt> stands for the filter name and <tt><ARG></tt> represents filter arguments. To obtain a list of known filter names, run:<br />
<br />
mailutils filter --list<br />
<br />
Filters are applied in the order of their appearence, from left to right and operate in encode mode. The plus sign has the same meaning as pipe in shell. The default mode can be changed using the <tt>--decode</tt> (<tt>-d</tt>) and <tt>--encode</tt> (<tt>-e</tt>) options. Whatever the default mode is, a <tt>~</tt> before filter name reverts the mode for that filter alone.<br />
<br />
For example, to encode the contents of file <tt>file.txt</tt> in Base64 run:<br />
<br />
mailutils filter base64 < file.txt<br />
<br />
To convert it to base64 and use CRLF as line delimiters, run:<br />
<br />
mailutils filter base64 + crlf < file.txt<br />
<br />
The following command will decode the produced output:<br />
<br />
mailutils filter --decode crlf + base64<br />
<br />
It can also be written as<br />
<br />
mailutils filter ~crlf + ~base64<br />
<br />
The following example [[Iconv (filter)|converts]] the input from ISO-8859-2 to UTF-8, [[From (filter)|quotes]] eventual <tt>From</tt> occurring at the beginning of a line, encodes the result in [[Base64 (filter)|Base64]] and [[CRLF (filter)|changes]] line delimiters to CRLF:<br />
<br />
mailutils filter iconv iso-8859-2 utf-8 + from + base64 + crlf<br />
<br />
This final example [[Inline-comment|removes UNIX-style comments]] from the input and [[Linecon|joins]] continuation lines:<br />
<br />
mailutils filter --decode inline-comment -S '#' + linecon <br />
<br />
Such invocation can be useful in shell scripts to facilitate configuration file processing.<br />
<br />
== See also ==<br />
* [[mailutils (utility)]]<br />
<br />
[[Category:utilities]]</div>Gray