title: How to extract an HTML anchor's href from a file in Bash?
body: <p>At the page <a href="https://developer.android.com/studio/index.html" rel="nofollow noreferrer">https://developer.android.com/studio/index.html</a>, there is a link to the Android SDK tools for Linux, which I'd like to download by a script. Unfortunately, there is no "easy" link to use to download the latest version, so I'd like to extract the link from the HTML itself.</p>
  
  <p>The link is identified by the id <code>linux-tools</code> and is contained on multiple lines:</p>
  
  <pre><code>  &lt;a onclick="return onDownload(this)" id="linux-tools" data-modal-toggle="studio_tos"
      href="https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip"&gt;sdk-tools-linux-38593
  </code></pre>
  
  <p>I'd like to extract that <code>href</code> into a variable in a Bash script. The closest I've gotten so far is the following:</p>
  
  <pre><code>grep -o -z '&lt;a.[^&lt;]*id="linux-tools"[^&lt;]*&lt;/a&gt;' index.html
  </code></pre>
  
  <p>which outputs the above two lines.</p>
  
  <p>How do I get at the actual link using typically-available shell commands?</p>