Bash: extract the scheme and host part from a URL string
<p>i need to strip the url from a given string.
The only solution i have is:</p>

<pre><code>_url="http://download.enlightenment.org/rel/apps/econnman/econnman-1.1.tar.gz"
_l=${_url%.*/*}        #  http://download.enlightenment
_l=${#_l}              #  29
_url=${_url:0:${l}+4}  #  http://download.enlightenment.org
</code></pre>

<p>But this will fail on every none 3 chars length TLD and it's just the wrong way.</p>

<p>thx a lot.</p>