--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/relpipe-data/examples-awk-through-xml.xml Sat Dec 28 16:19:41 2019 +0100
@@ -0,0 +1,55 @@
+<stránka
+ xmlns="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
+ xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro">
+
+ <nadpis>AWKing through a XML file</nadpis>
+ <perex>use AWK to filter data from a D-Bus policy file</perex>
+ <m:pořadí-příkladu>03700</m:pořadí-příkladu>
+
+ <text xmlns="http://www.w3.org/1999/xhtml">
+
+ <p>
+ The <a href="https://en.wikipedia.org/wiki/AWK">AWK</a> programming language and tool is designed for processing text
+ but in <m:name/> we can use all the power of AWK for processing relational data that came from various sources.
+ And „all the power“ means that we internally call the regular AWK implementation installed in our system (which is usually GNU AWK).
+ </p>
+
+ <p>
+ In this example, we will read a D-Bus policy configuration file (an XML)
+ and filter it using a simple AWK expression.
+ The XML file looks like this:
+ </p>
+
+ <m:pre jazyk="xml" src="examples/awk-through-xml.xml"/>
+
+ <p>
+ We separate particular steps of our pipeline to shell functions for better readability and maintenance:
+ </p>
+
+ <m:pre jazyk="bash" src="examples/awk-through-xml.sh"/>
+
+ <p>
+ This simple sequence of steps will generate following result:
+ </p>
+
+ <m:pre jazyk="text" src="examples/awk-through-xml.txt"/>
+
+ <p>
+ We have processed two relations.
+ One (<code>limit</code>) was just passed through
+ while another (<code>policy</code>) was transformed.
+ In this case, we did just restriction (filtered certain records), but we can do also projections or other relational operations in our pipelines.
+ </p>
+
+ <p>
+ This example also shows how we can structure our scripts – compose the pipeline from reusable fragments (shell functions).
+ Once we write the <em>parse</em> function for an input format, we can use it many times, with various filters/transformations and output formatters.
+ </p>
+ <p>
+ Instead of converting to an output format, we can also <m:a href="examples-out-bash">execute arbitrary system commands</m:a> for each record
+ (while having particular attribute values reliably separated in shell variables).
+ </p>
+
+ </text>
+
+</stránka>