title: Piping unfiltered text to an awk system command's stdin
body: <p>I have an gawk script that has accumulated a bunch of HTML in a variable, and now should pipe it to lynx via a system command.</p>
  
  <p>(feel free to tell me AWK is a bad solution... <code>while read LINE;</code> was wildly bad (slow), so this is take 2)</p>
  
  <p>I tried this in awk:</p>
  
  <pre><code>    cmd = sprintf( "bash -c \'lynx -dump -force_html -stdin &lt;&lt;&lt; \"%s\"\'", html )
      system ( cmd )
  </code></pre>
  
  <p>Bad idea, although simple test cases work, with raw HTML, special character issues and string termination issues abound, and escapes-within-escapes-within-escapes is just getting mindbogglingly complex.</p>
  
  <p>lynx handles well whatever I throw at it on stdin, I just can't get it to stdin from awk without piping it through the the command line, which seems like an unwieldy solution.</p>
  
  <hr>
  
  <p>Edit (adding detail about my end goal) in case awk isn't a good approach:</p>
  
  <p>What I want is to parse HTML out of a large text file with delimiters between blocks of html. I need to pass each block of HTML to lynx to be formatted and dump that into a new, big text file. </p>
  
  <hr>
  
  <p>Example input (a dump from another system):</p>
  
  <pre><code>**********URL: http://some/url
  &lt;html&gt;
  &lt;head&gt;&lt;title&gt;Any 'ol HTML document&lt;/title&lt;/head&gt;
  &lt;body&gt;
  &lt;p&gt;With pretty much any character you can imagine at some point&lt;/p&gt;
  &lt;p&gt;I'm using lynx to strip off the HTML and give me a nice format&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  **********URL: http://another/url
  &lt;html&gt;&lt;head&gt;&lt;title&gt;My input file provides a few 100,000 such html documents&lt;/title&gt;&lt;/head&gt;
  &lt;body/&gt;&lt;/html&gt;
  </code></pre>
  
  <p>Each HTML document should be feed through <code>lynx -dump</code>. Lynx can read in the HTML from file (e.g. named pipe, or file is an option), or stdin (with the -stdin option).</p>
  
  <p>My output is then:</p>
  
  <pre><code>**********URL: http://some/url
    Any 'ol HTML document
  
    With pretty much any character you can imagine at some point
    I'm using lynx to strip off the HTML and give me a nice format
  **********URL: http://another/url
    My input file provides a few 100,000 such html documents
  </code></pre>