title: How to strip out all of the links of an HTML file in Bash or grep or batch and store them in a text file
body: <p>I have a file that is <a href="http://en.wikipedia.org/wiki/HTML" rel="noreferrer">HTML</a>, and it has about 150 anchor tags. I need only the links from these tags, AKA, <code>&lt;a href="*http://www.google.com*"&gt;&lt;/a&gt;</code>. I want to get only the <a href="http://www.google.com" rel="noreferrer">http://www.google.com</a> part.</p>
  
  <p>When I run a grep,</p>
  
  <pre><code>cat website.htm | grep -E '&lt;a href=".*"&gt;' &gt; links.txt
  </code></pre>
  
  <p>this returns the entire line to me that it found on not the link I want, so I tried using a <a href="http://linux.die.net/man/1/cut" rel="noreferrer"><code>cut</code></a> command:</p>
  
  <pre><code>cat drawspace.txt | grep -E '&lt;a href=".*"&gt;' | cut -d’”’ --output-delimiter=$'\n' &gt; links.txt
  </code></pre>
  
  <p>Except that it is wrong, and it doesn't work give me some error about wrong parameters... So I assume that the file was supposed to be passed along too. Maybe like <code>cut -d’”’ --output-delimiter=$'\n' grepedText.txt &gt; links.txt</code>.</p>
  
  <p>But I wanted to do this in one command if possible... So I tried doing an <a href="http://en.wikipedia.org/wiki/AWK" rel="noreferrer">AWK</a> command.</p>
  
  <pre><code>cat drawspace.txt | grep '&lt;a href=".*"&gt;' | awk '{print $2}’
  </code></pre>
  
  <p>But this wouldn't run either. It was asking me for more input, because I wasn't finished....</p>
  
  <p>I tried writing a batch file, and it told me FINDSTR is not an internal or external command... So I assume my environment variables were messed up and rather than fix that I tried installing grep on Windows, but that gave me the same error....</p>
  
  <p>The question is, what is the right way to strip out the HTTP links from <a href="http://en.wikipedia.org/wiki/HTML" rel="noreferrer">HTML</a>? With that I will make it work for my situation.</p>
  
  <p>P.S. I've read so many links/Stack&nbsp;Overflow posts that showing my references would take too long.... If example HTML is needed to show the complexity of the process then I will add it.</p>
  
  <p>I also have a Mac and PC which I switched back and forth between them to use their shell/batch/grep command/terminal commands, so either or will help me.</p>
  
  <p>I also want to point out I'm in the correct directory</p>
  
  <p><img src="https://i.stack.imgur.com/1Rhyx.png" alt="Enter image description here"></p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;tr valign="top"&gt;
      &lt;td class="beginner"&gt;
        B03&amp;nbsp;&amp;nbsp;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;a href="http://www.drawspace.com/lessons/b03/simple-symmetry"&gt;Simple Symmetry&lt;/a&gt;  &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr valign="top"&gt;
    &lt;td class="beginner"&gt;
      B04&amp;nbsp;&amp;nbsp;
    &lt;/td&gt;
    &lt;td&gt;
        &lt;a href="http://www.drawspace.com/lessons/b04/faces-and-a-vase"&gt;Faces and a Vase&lt;/a&gt; &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr valign="top"&gt;
      &lt;td class="beginner"&gt;
        B05&amp;nbsp;&amp;nbsp;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;a href="http://www.drawspace.com/lessons/b05/blind-contour-drawing"&gt;Blind Contour Drawing&lt;/a&gt; &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr valign="top"&gt;
      &lt;td class="beginner"&gt;
          B06&amp;nbsp;&amp;nbsp;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;a href="http://www.drawspace.com/lessons/b06/seeing-values"&gt;Seeing Values&lt;/a&gt; &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>http://www.drawspace.com/lessons/b03/simple-symmetry
  http://www.drawspace.com/lessons/b04/faces-and-a-vase
  http://www.drawspace.com/lessons/b05/blind-contour-drawing
  etc.
  </code></pre>