From d45e83060849ab8547342f24954eefa1440e688a Mon Sep 17 00:00:00 2001
From: Martin Goik <goik@hdm-stuttgart.de>
Date: Thu, 12 May 2016 21:53:59 +0200
Subject: [PATCH] Small extension hint

---
 Doc/Sd1/appendix.xml | 90 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 80 insertions(+), 10 deletions(-)

diff --git a/Doc/Sd1/appendix.xml b/Doc/Sd1/appendix.xml
index 9cd98d225..ed54d613f 100644
--- a/Doc/Sd1/appendix.xml
+++ b/Doc/Sd1/appendix.xml
@@ -313,13 +313,13 @@
       <title>Poor man's <xref linkend="glo_UNIX"/> <command
       xlink:href="http://linux.die.net/man/1/grep">grep</command>.</title>
 
-      <para>The <xref linkend="glo_UNIX"/> operating system provides the
+      <para>The <xref linkend="glo_UNIX"/> operating system provides a command
       <command xlink:href="http://linux.die.net/man/1/grep">grep</command>
-      command which allows for retrieving occurrences of given strings in text
-      files. We consider an example text file <filename>input.txt</filename>
+      which allows for retrieving occurrences of a given string in text files.
+      We consider an example text file <filename>input.txt</filename>
       containing four lines:</para>
 
-      <programlisting language="none" linenumbering="unnumbered">Roses are nice flowers.
+      <programlisting language="none" linenumbering="numbered">Roses are nice flowers.
 Red wine is tasty
 The red cross acts worldwide
 Mayflower used to be a ship.</programlisting>
@@ -328,7 +328,7 @@ Mayflower used to be a ship.</programlisting>
       occurrence of the string <quote>flower</quote> being contained in lines
       1 and 4:</para>
 
-      <programlisting language="none">&gt;grep <emphasis role="bold">flower</emphasis> input.txt 
+      <programlisting language="none">&gt; grep <emphasis role="bold">flower</emphasis> input.txt 
 Roses are nice <emphasis role="bold">flower</emphasis>s.
 May<emphasis role="bold">flower</emphasis> used to be a ship.</programlisting>
 
@@ -338,18 +338,88 @@ May<emphasis role="bold">flower</emphasis> used to be a ship.</programlisting>
       output. Adding the command line option <option>-i</option> allows for
       case insensitive searches:</para>
 
-      <programlisting language="none" linenumbering="unnumbered">&gt;grep <option>-i</option> <emphasis
-          role="bold">red</emphasis> input.txt 
+      <programlisting language="none" linenumbering="unnumbered">&gt; grep <option>-i</option> <emphasis
+          role="bold">red</emphasis> input.txt
 <emphasis role="bold">Red</emphasis> wine is tasty
 The <emphasis role="bold">red</emphasis> cross acts worldwide</programlisting>
 
       <para>This time all possible variants like <quote>Red</quote>,
-      <quote>red</quote>, <quote>RED</quote> and so on will match. </para>
+      <quote>red</quote>, <quote>RED</quote> and so on will match.</para>
 
       <para><command
       xlink:href="http://linux.die.net/man/1/grep">grep</command> also allows
-      for searching multiple files. Consider another text file
-      second.txt:</para>
+      for searching multiple files. Consider a second file
+      <filename>inputSecond.txt</filename>:</para>
+
+      <programlisting language="none" linenumbering="numbered">Errors will show up in red.
+Let's start bug fixing</programlisting>
+
+      <para>We may search for case insensitive (<option>-i</option> again)
+      appearances of <quote>red</quote> within both files:</para>
+
+      <programlisting language="none" linenumbering="unnumbered">&gt; grep -i <emphasis
+          role="bold">red</emphasis> input.txt  inputSecond.txt 
+input.txt:<emphasis role="bold">Red</emphasis> wine is tasty
+input.txt:The <emphasis role="bold">red</emphasis> cross acts worldwide
+inputSecond.txt:Errors will show up in <emphasis role="bold">red</emphasis>.</programlisting>
+
+      <para>Finally the <option>-l</option> option will filter individual
+      appearances just showing filenames containing matches:</para>
+
+      <programlisting language="none">&gt; grep -l Red input.txt  inputSecond.txt 
+input.txt</programlisting>
+
+      <para>In contrast a case insensitive search combining both
+      <option>-i</option> and <option>-l</option> options yields:</para>
+
+      <programlisting language="none">&gt; grep -i -l Red input.txt  inputSecond.txt 
+input.txt
+inputSecond.txt</programlisting>
+
+      <para>The <command
+      xlink:href="http://linux.die.net/man/1/grep">grep</command> command may
+      read its input from standard input allowing for <link
+      xlink:href="https://en.wikipedia.org/wiki/Pipeline_(Unix)">pipes</link>.
+      This way another command's output feeds into a subsequently executed
+      command. As an example consider a recursive search for HTML files using
+      the <link xlink:href="http://linux.die.net/man/1/find">find</link>
+      command:</para>
+
+      <programlisting language="none">&gt; find . -name \*.html
+./Sd1/Wc/wc/Testdata/input.html
+./Sda1/rdbmsXml2Html/TestData/climbingprice.html
+./Sda1/NoCast/src/main/resources/gallery.html
+./Sda1/Jdom/Html2Html/src/main/resources/imageExampleNew.html
+./Sda1/Jdom/Html2Html/src/main/resources/imageExample.html
+./Sda1/VerifyImgAccess/fileextref.html</programlisting>
+
+      <para>We want to restrict the above list to pathnames containing the
+      string <quote>Example</quote>. This may be achieved by <link
+      xlink:href="https://en.wikipedia.org/wiki/Pipeline_(Unix)">piping</link>
+      the <link xlink:href="http://linux.die.net/man/1/find">find</link>
+      command's output as input to <command
+      xlink:href="http://linux.die.net/man/1/grep">grep</command> searching
+      for the occurrence of the string <quote>Example</quote>. Technically
+      both processes get connected by means of the pipe symbol
+      <quote>|</quote>:</para>
+
+      <programlisting language="none">&gt; find . -name \*.html|grep Example
+./Sda1/Jdom/Html2Html/src/main/resources/imageExampleNew.html
+./Sda1/Jdom/Html2Html/src/main/resources/imageExample.html</programlisting>
+
+      <tip>
+        <para/>
+
+        <orderedlist>
+          <listitem>
+            <para/>
+          </listitem>
+
+          <listitem>
+            <para/>
+          </listitem>
+        </orderedlist>
+      </tip>
     </section>
 
     <section xml:id="sd1ProjectSieveErathostenes">
-- 
GitLab