title: Bash script to return domains instead of URL's
body: <p>I have this bash script that i wrote to analyse the html of any given web page. What its actually supposed to do is to return the domains on that page. Currently its returning the number of URL's on that web page.</p>
  
  <pre><code>#!/bin/sh
  
  echo "Enter a url eg www.bbc.com:"
  read url
  content=$(wget "$url" -q -O -)
  echo "Enter file name to store URL output"
  read file
  echo $content &gt; $file
  echo "Enter file name to store filtered links:"
  read links
  found=$(cat $file | grep -o -E 'href="([^"#]+)"' | cut -d '"' -f2 | sort | uniq | awk   '/http/' &gt; $links)
  output=$(egrep -o '^http://[^/]+/' $links | sort | uniq -c &gt; out)
  cat out
  </code></pre>
  
  <p>How can i get it to return the domains instead of the URL's. From my programming knowledge I know its supposed to do parsing from the right but i am a newbie at bash scripting. Can someone please help me. This is as far as I have gone.</p>